bfsscp

package module
v0.11.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

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

New initiates an bfs.Bucket backed by ssh.

Types

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL