Documentation
¶
Overview ¶
Package transport holds the unexported FTP/FTPS/SFTP protocol implementations. It has no dependency on the root ramify package - callers adapt Endpoint/uploader to/from the options and clients here.
Index ¶
- type FTPClient
- func (c *FTPClient) Close() error
- func (c *FTPClient) Delete(remoteName string) error
- func (c *FTPClient) Size(remoteName string) (int64, error)
- func (c *FTPClient) Upload(remoteName string, r io.Reader, size int64, progress func(sent, total int64)) error
- func (c *FTPClient) Verify(localPath, remoteName string) (method string, err error)
- type FTPDialOptions
- type FTPSDialOptions
- type SFTPClient
- func (c *SFTPClient) Close() error
- func (c *SFTPClient) Delete(remoteName string) error
- func (c *SFTPClient) Size(remoteName string) (int64, error)
- func (c *SFTPClient) Upload(remoteName string, r io.Reader, size int64, progress func(sent, total int64)) error
- func (c *SFTPClient) Verify(localPath, remoteName string) (method string, err error)
- type SFTPDialOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FTPClient ¶
type FTPClient struct {
// contains filtered or unexported fields
}
FTPClient wraps a connected FTP (or FTPS, via explicit AUTH TLS) session. Not safe for concurrent use, matching the "one reused connection per endpoint worker" model the engine drives it with.
func DialFTP ¶
func DialFTP(ctx context.Context, opts FTPDialOptions) (*FTPClient, error)
DialFTP connects and authenticates over plain FTP.
func DialFTPS ¶
func DialFTPS(ctx context.Context, opts FTPSDialOptions) (*FTPClient, error)
DialFTPS connects and authenticates over FTP with explicit AUTH TLS. It returns the same FTPClient as DialFTP - once connected, FTP and FTPS sessions behave identically for upload/delete/verify/list.
func (*FTPClient) Delete ¶
Delete removes remoteName, treating "file doesn't exist" as success since it's called unconditionally before every upload under the delete-first overwrite mode.
type FTPDialOptions ¶
type FTPDialOptions struct {
Host string
Port int // 0 means defaultFTPPort
Username string
Password string
ConnectTimeout time.Duration
StallTimeout time.Duration // 0 disables idle-stall protection
}
FTPDialOptions configures a plain-FTP connection.
type FTPSDialOptions ¶
type FTPSDialOptions struct {
Host string
Port int // 0 means defaultFTPPort
Username string
Password string
ConnectTimeout time.Duration
StallTimeout time.Duration // 0 disables idle-stall protection
// TLSConfig overrides the default. Optional; ServerName or
// ClientSessionCache left unset are filled in automatically (see
// resolveTLSConfig) - required for many servers' data connections.
TLSConfig *tls.Config
}
FTPSDialOptions configures an explicit-AUTH-TLS FTP connection (the ftps protocol): the control connection starts on port 21 like plain FTP and upgrades via AUTH TLS, not implicit FTPS on a separate port.
type SFTPClient ¶
type SFTPClient struct {
// contains filtered or unexported fields
}
SFTPClient wraps a connected SSH+SFTP session. Not safe for concurrent use.
func DialSFTP ¶
func DialSFTP(ctx context.Context, opts SFTPDialOptions) (*SFTPClient, error)
DialSFTP connects over SSH and opens an SFTP session. The remote host key is verified against ~/.ssh/known_hosts - no insecure fallback; an unrecognized host fails, matching OpenSSH's trust-on-first-use flow.
func (*SFTPClient) Close ¶
func (c *SFTPClient) Close() error
Close ends the SFTP session and the underlying SSH connection.
func (*SFTPClient) Delete ¶
func (c *SFTPClient) Delete(remoteName string) error
Delete removes remoteName, treating "file doesn't exist" as success since it's called unconditionally before every upload under the delete-first overwrite mode.
func (*SFTPClient) Size ¶
func (c *SFTPClient) Size(remoteName string) (int64, error)
Size returns the remote file's size in bytes.
type SFTPDialOptions ¶
type SFTPDialOptions struct {
Host string
Port int // 0 means defaultSFTPPort
Username string
Password string
PrivateKeyPath string
ConnectTimeout time.Duration
StallTimeout time.Duration // 0 disables idle-stall protection
}
SFTPDialOptions configures an SSH/SFTP connection. If both Password and PrivateKeyPath are set, the key takes priority and Password is tried as its passphrase; otherwise whichever is set is used alone.