Back to godoc.org
github.com/bsm/bfs/bfsscp

Package bfsscp

v0.0.0 (b611316)
Latest Go to latest
Published: May 26, 2020 | License: Apache-2.0 | Module: github.com/bsm/bfs/bfsscp

Overview

Package bfsscp abstracts an SSH/SCP workflow

When imported, it registers both `scp://` and `ssh://` global scheme resolver and can be used like:

import (
  "github.com/bsm/bfs"

  _ "github.com/bsm/bfs/bfsscp"
)

func main() {
  ctx := context.Background()
  b, _ := bfs.Connect(ctx, "ssh://user:pass@hostname:22/path/to/root?tmpdir=%2Fcustom%2Ftmp")
  f, _ := b.Open(ctx, "file/within/root.txt")
  ...
}

bfs.Connect supports the following query parameters:

tmpdir - custom temp dir

Index

Package Files

func New

func New(address string, cfg *Config) (bfs.Bucket, error)

New initiates an bfs.Bucket backed by ssh.

type Config

type Config struct {
	// Username to use.
	Username string
	// Password to use in combination with Username.
	Password string
	// An optional path prefix.
	Prefix string
	// A custom temp dir.
	TempDir string
}

Config is passed to New to configure the SSH connection.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier