Documentation
¶
Index ¶
- Constants
- type Config
- type Driver
- func (d *Driver) AbortMultipart(ctx context.Context, key string, uploadID string) error
- func (d *Driver) Capabilities() blobkit.Capability
- func (d *Driver) Close() error
- func (d *Driver) CompleteMultipart(ctx context.Context, obj *blobkit.Object, uploadID string, ...) (*blobkit.Object, error)
- func (d *Driver) Copy(ctx context.Context, srcKey, dstKey string) error
- func (d *Driver) CreateMultipart(ctx context.Context, obj *blobkit.Object, opts blobkit.PutOptions) (string, error)
- func (d *Driver) Delete(ctx context.Context, key string) error
- func (d *Driver) DeleteBatch(ctx context.Context, keys []string) ([]string, error)
- func (d *Driver) Get(ctx context.Context, key string, opts blobkit.GetOptions) (*blobkit.ObjectReader, error)
- func (d *Driver) Head(ctx context.Context, key string) (*blobkit.Object, error)
- func (d *Driver) List(ctx context.Context, opts blobkit.ListOptions) (*blobkit.ListResult, error)
- func (d *Driver) ListParts(ctx context.Context, key string, uploadID string) ([]blobkit.CompletedPart, error)
- func (d *Driver) Name() string
- func (d *Driver) PresignGet(ctx context.Context, key string, opts blobkit.PresignOptions) (*blobkit.PresignedURL, error)
- func (d *Driver) PresignPut(ctx context.Context, key string, opts blobkit.PresignOptions) (*blobkit.PresignedURL, error)
- func (d *Driver) Put(ctx context.Context, obj *blobkit.Object, r io.Reader, opts blobkit.PutOptions) (*blobkit.Object, error)
- func (d *Driver) ResolveURL(key string) (string, error)
- func (d *Driver) UploadPart(ctx context.Context, key string, uploadID string, partNumber int32, ...) (string, error)
Constants ¶
const ( // DefaultPort is the standard SSH/SFTP port. DefaultPort = 22 // DefaultTimeout is the standard timeout for SSH dial and handshake. DefaultTimeout = 30 * time.Second // DefaultDirMode is the default POSIX permission for directory creation. DefaultDirMode os.FileMode = 0755 // DefaultFileMode is the default POSIX permission for file creation. DefaultFileMode os.FileMode = 0644 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Name is the driver identifier (e.g. "sftp-primary", "sftp-backup"). Defaults to "sftp".
Name string
// Host is the remote SSH host or IP address. Required.
Host string
// Port is the remote SSH port. Defaults to 22.
Port int
// User is the SSH login username. Required.
User string
// Password is the SSH login password. Optional if PrivateKeyPEM is provided.
Password string
// PrivateKeyPEM contains raw RSA, ECDSA, or Ed25519 private key PEM bytes. Optional if Password is provided.
PrivateKeyPEM []byte
// PrivateKeyPassphrase is the decryption passphrase for encrypted private keys.
PrivateKeyPassphrase string
// HostKey is the expected remote server public key for strict host key verification.
HostKey ssh.PublicKey
// InsecureIgnoreHostKey disables SSH host key verification (recommended only for dev/testing).
InsecureIgnoreHostKey bool
// BaseDir is the root directory path on the remote SFTP server where blobs are stored.
BaseDir string
// EnableSidecarMeta persists <key>.meta.json sidecar files on the SFTP server for metadata fidelity.
EnableSidecarMeta bool
// PublicBaseURL is an optional base URL for public CDN/HTTP gateway access (e.g. "https://cdn.example.com").
PublicBaseURL string
// Timeout is the SSH network connection and handshake timeout. Defaults to 30 seconds.
Timeout time.Duration
// DirMode specifies the file mode permissions used when creating remote directories. Defaults to 0755.
DirMode os.FileMode
// FileMode specifies the file mode permissions used when creating remote files. Defaults to 0644.
FileMode os.FileMode
}
Config specifies configuration parameters for the SFTP storage driver.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements the blobkit.Driver interface for remote SFTP servers.
func (*Driver) AbortMultipart ¶
AbortMultipart is unsupported on native SFTP.
func (*Driver) Capabilities ¶
func (d *Driver) Capabilities() blobkit.Capability
Capabilities returns the feature bitmask supported by the SFTP driver.
func (*Driver) CompleteMultipart ¶
func (d *Driver) CompleteMultipart(ctx context.Context, obj *blobkit.Object, uploadID string, parts []blobkit.CompletedPart) (*blobkit.Object, error)
CompleteMultipart is unsupported on native SFTP.
func (*Driver) CreateMultipart ¶
func (d *Driver) CreateMultipart(ctx context.Context, obj *blobkit.Object, opts blobkit.PutOptions) (string, error)
CreateMultipart is unsupported on native SFTP.
func (*Driver) Delete ¶
Delete permanently removes a file and its associated .meta.json sidecar from the SFTP server.
func (*Driver) DeleteBatch ¶
DeleteBatch removes multiple keys concurrently using a bounded worker pool.
func (*Driver) Get ¶
func (d *Driver) Get(ctx context.Context, key string, opts blobkit.GetOptions) (*blobkit.ObjectReader, error)
Get opens a remote SFTP file and streams its content, supporting HTTP byte-range seeks.
func (*Driver) Head ¶
Head inspects a remote SFTP file and loads metadata without reading the file body.
func (*Driver) List ¶
func (d *Driver) List(ctx context.Context, opts blobkit.ListOptions) (*blobkit.ListResult, error)
List queries objects on the remote SFTP server matching prefix and delimiter filters.
func (*Driver) ListParts ¶
func (d *Driver) ListParts(ctx context.Context, key string, uploadID string) ([]blobkit.CompletedPart, error)
ListParts is unsupported on native SFTP.
func (*Driver) PresignGet ¶
func (d *Driver) PresignGet(ctx context.Context, key string, opts blobkit.PresignOptions) (*blobkit.PresignedURL, error)
PresignGet is unsupported on native SFTP.
func (*Driver) PresignPut ¶
func (d *Driver) PresignPut(ctx context.Context, key string, opts blobkit.PresignOptions) (*blobkit.PresignedURL, error)
PresignPut is unsupported on native SFTP.
func (*Driver) Put ¶
func (d *Driver) Put(ctx context.Context, obj *blobkit.Object, r io.Reader, opts blobkit.PutOptions) (*blobkit.Object, error)
Put streams an object to the remote SFTP server, writing to a temporary file before atomically renaming to prevent partial reads.
func (*Driver) ResolveURL ¶
ResolveURL builds a public access or CDN URL if configured.