Documentation ¶
Index ¶
- Variables
- func CreateSSHConfig(inputConf *Input) (*ssh.ClientConfig, error)
- func GetConfig(confFile string) (map[string][]TransferConfig, error)
- func GetSFTPConfig(sshhostkey string) *ssh.ServerConfig
- func ListenSFTPServer(lis net.Listener, sshhostkey string) error
- type Client
- func (client *Client) GetListOfFiles(rootDir string) []FileStat
- func (client *Client) MultiFilesPull(fileList chan FileStat, outputPath string, length int) chan FileStat
- func (client *Client) Open(filepath string) (io.ReadWriteCloser, error)
- func (client *Client) Pull(inputfile, outputfile string) (int64, error)
- func (client *Client) Push(inputfile, outputfile string) (int64, error)
- func (client *Client) Stat(filename string) (os.FileInfo, error)
- func (client *Client) Walk(rootDir string) *fs.Walker
- type Config
- type FileStat
- type Input
- type Op
- type TransferConfig
Constants ¶
This section is empty.
Variables ¶
var OpEnum = &Op{
Encrypt: 1,
Decrypt: 0,
}
OpEnum is the Enum for encryption operations
var RawEncryptionKey = "SlNqVVhZalpzWWg5ZkRWOENvWHdwNzhITnl3RnpnWnFE"
RawEncryptionKey is for the AES encryption key, it is base64Encoded.
Functions ¶
func CreateSSHConfig ¶
func CreateSSHConfig(inputConf *Input) (*ssh.ClientConfig, error)
CreateSSHConfig returns a config instance used to create an ssh/sftp connection.
func GetConfig ¶
func GetConfig(confFile string) (map[string][]TransferConfig, error)
GetConfig returns the parsed config
func GetSFTPConfig ¶
func GetSFTPConfig(sshhostkey string) *ssh.ServerConfig
GetSFTPConfig returns the config for the ssh/sftp server
Types ¶
type Client ¶
Client is a struct for client object + properties
func CreateClient ¶
CreateClient creates an sftp client
func (*Client) GetListOfFiles ¶
GetListOfFiles gets the list of files on a remote sftp server
func (*Client) MultiFilesPull ¶
func (client *Client) MultiFilesPull(fileList chan FileStat, outputPath string, length int) chan FileStat
MultiFilesPull is for pulling multiple files in parallel
func (*Client) Open ¶
func (client *Client) Open(filepath string) (io.ReadWriteCloser, error)
Open is a wrapper around sftp Open function
func (*Client) Pull ¶
Pull copies inputfile from a remote sftp server as outputfile on the local filesystem.
type Config ¶
type Config interface { EncryptSecureFields(key string) error DecryptSecureFields(key string) error EncodeGob() error DecodeGob() error }
Config is the Interface for methods on TransferConfig struct
type Input ¶
type Input struct { Address string Username string Password string Protocol string // AuthMethod: One of pk, pk+pass, pass AuthMethod string PrivateKey string // ? ConnectionType string }
Input is a struct for creating the sftp client
type TransferConfig ¶
type TransferConfig struct { TransferID string `json:"transfer_id"` Description string `json:"description"` Type string `json:"type"` LocalFile string `json:"local_file"` LocalPath string `json:"local_path"` RemoteFile string `json:"remote_file"` RemotePath string `json:"remote_path"` RemoteHost string `json:"remote_host"` RemotePort int `json:"remote_port"` RemoteUser string `json:"remote_user"` RemotePassword string `json:"remote_password"` RemoteAuthKeyFile string `json:"remote_auth_key"` }
TransferConfig is the struct for parsing the configs
func (*TransferConfig) DecodeGob ¶
func (config *TransferConfig) DecodeGob(value []byte) error
DecodeGob takes a encoded Gob as a byte array and updates the struct instance with the decoded values
func (*TransferConfig) DecryptSecureFields ¶
func (config *TransferConfig) DecryptSecureFields() error
DecryptSecureFields decrypts the fields of the struct instance.
func (*TransferConfig) EncodeGob ¶
func (config *TransferConfig) EncodeGob() ([]byte, error)
EncodeGob Returns Gob encoded byte array of struct
func (*TransferConfig) EncryptSecureFields ¶
func (config *TransferConfig) EncryptSecureFields() error
EncryptSecureFields encrypts the fields of struct instance.