Versions in this module Expand all Collapse all v0 v0.1.4 Oct 4, 2026 Changes in this version + const DefaultFTPTimeout + const DefaultMaxBytes + const DefaultMinioTimeout + const DefaultSFTPTimeout + const DefaultWebDAVTimeout + var ErrExists = errors.New("目标已存在") + func CopyLimited(ctx context.Context, w io.Writer, r io.Reader, limit int64) (int64, error) + func ReadLimited(ctx context.Context, r io.Reader, limit int64) ([]byte, error) + func ResolveInRoot(root, name string) (string, error) + func SanitizeName(name string) string + type BufferSink struct + Limit int64 + func NewBufferSink(limit int64) *BufferSink + func (s *BufferSink) Bytes() []byte + func (s *BufferSink) MaxBytesLimit() int64 + func (s *BufferSink) Put(ctx context.Context, name string, r io.Reader) (Location, error) + type BytesSource struct + Data []byte + File string + func NewBytesSource(data []byte, file string) *BytesSource + func (s *BytesSource) Close() error + func (s *BytesSource) Name() string + func (s *BytesSource) Open(context.Context) (io.ReadCloser, error) + type DirSink struct + MaxBytes int64 + Overwrite bool + Root string + func NewDirSink(root string) *DirSink + func (s *DirSink) MaxBytesLimit() int64 + func (s *DirSink) Put(ctx context.Context, name string, r io.Reader) (Location, error) + type FTPSink struct + Addr string + BaseDir string + DisableEPSV bool + IdleTTL time.Duration + Implicit bool + Insecure bool + MaxBytes int64 + MaxIdle int + Overwrite bool + OwnsPool bool + Password string + TLSConfig *tls.Config + Timeout time.Duration + User string + func (s *FTPSink) Close() error + func (s *FTPSink) MaxBytesLimit() int64 + func (s *FTPSink) Put(ctx context.Context, name string, r io.Reader) (Location, error) + func (s *FTPSink) SetLogger(log *slog.Logger) + func (s *FTPSink) WithBaseDir(sub string) (*FTPSink, error) + type FileSource struct + Keep bool + Path string + func NewFileSource(path string, keep bool) *FileSource + func (s *FileSource) Close() error + func (s *FileSource) Name() string + func (s *FileSource) Open(context.Context) (io.ReadCloser, error) + type HTTPAudit struct + Bytes int64 + Fetched string + Requested string + Resolved []string + StatusCode int + type HTTPSource struct + AllowRedirect bool + Allowlist *allowlist.List + FileName string + Log *slog.Logger + MaxBytes int64 + Timeout time.Duration + URL string + UserAgent string + func (s *HTTPSource) Audit() *HTTPAudit + func (s *HTTPSource) Close() error + func (s *HTTPSource) Name() string + func (s *HTTPSource) Open(ctx context.Context) (io.ReadCloser, error) + type LimitedSink interface + MaxBytesLimit func() int64 + type Location struct + Bucket string + Key string + Kind string + Path string + Size int64 + URL string + type MinioSink struct + AccessKey string + BasePrefix string + Bucket string + Endpoint string + MaxBytes int64 + Overwrite bool + Region string + SecretKey string + Secure bool + SessionToken string + Timeout time.Duration + func (s *MinioSink) Close() error + func (s *MinioSink) EndpointURL() string + func (s *MinioSink) MaxBytesLimit() int64 + func (s *MinioSink) Put(ctx context.Context, name string, r io.Reader) (Location, error) + func (s *MinioSink) SetLogger(log *slog.Logger) + func (s *MinioSink) WithBasePrefix(prefix string) (*MinioSink, error) + type SFTPAuth struct + AgentSocket string + Password string + PrivateKeyFile string + PrivateKeyPassphrase string + type SFTPSink struct + Addr string + Auth SFTPAuth + BaseDir string + HostKeyFile string + HostKeySHA256 string + IdleTTL time.Duration + InsecureIgnoreHostKey bool + MaxBytes int64 + MaxIdle int + Overwrite bool + OwnsPool bool + Timeout time.Duration + User string + func (s *SFTPSink) Close() error + func (s *SFTPSink) MaxBytesLimit() int64 + func (s *SFTPSink) Put(ctx context.Context, name string, r io.Reader) (Location, error) + func (s *SFTPSink) SetLogger(log *slog.Logger) + func (s *SFTPSink) WithBaseDir(dir string) (*SFTPSink, error) + type Sink interface + Put func(ctx context.Context, name string, r io.Reader) (Location, error) + type Source interface + Close func() error + Name func() string + Open func(ctx context.Context) (io.ReadCloser, error) + type WebDAVSink struct + BaseDir string + Endpoint string + MaxBytes int64 + Overwrite bool + Password string + Timeout time.Duration + User string + func (s *WebDAVSink) Close() error + func (s *WebDAVSink) MaxBytesLimit() int64 + func (s *WebDAVSink) Put(ctx context.Context, name string, r io.Reader) (Location, error) + func (s *WebDAVSink) SetLogger(log *slog.Logger) + func (s *WebDAVSink) WithBaseDir(dir string) (*WebDAVSink, error)