Documentation
¶
Index ¶
- type FTPHandler
- type HTTPHandler
- type ProtocolHandler
- type ProtocolRegistry
- func (pr *ProtocolRegistry) Download(ctx context.Context, urlStr string, options *types.DownloadOptions) (*types.DownloadStats, error)
- func (pr *ProtocolRegistry) GetHandler(urlStr string) (ProtocolHandler, error)
- func (pr *ProtocolRegistry) ListProtocols() []string
- func (pr *ProtocolRegistry) Register(handler ProtocolHandler) error
- func (pr *ProtocolRegistry) Unregister(scheme string) error
- type S3Handler
- type TorrentHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FTPHandler ¶
type FTPHandler struct{}
FTPHandler handles FTP and FTPS protocols
func (*FTPHandler) CanHandle ¶
func (f *FTPHandler) CanHandle(url string) bool
func (*FTPHandler) Download ¶
func (f *FTPHandler) Download(ctx context.Context, url string, options *types.DownloadOptions) (*types.DownloadStats, error)
func (*FTPHandler) Scheme ¶
func (f *FTPHandler) Scheme() string
type HTTPHandler ¶
type HTTPHandler struct{}
HTTPHandler handles HTTP and HTTPS protocols
func (*HTTPHandler) CanHandle ¶
func (h *HTTPHandler) CanHandle(url string) bool
func (*HTTPHandler) Download ¶
func (h *HTTPHandler) Download(ctx context.Context, url string, options *types.DownloadOptions) (*types.DownloadStats, error)
func (*HTTPHandler) Scheme ¶
func (h *HTTPHandler) Scheme() string
type ProtocolHandler ¶
type ProtocolHandler interface {
Scheme() string
CanHandle(url string) bool
Download(ctx context.Context, url string, options *types.DownloadOptions) (*types.DownloadStats, error)
}
ProtocolHandler defines the interface for protocol-specific download handlers
type ProtocolRegistry ¶
type ProtocolRegistry struct {
// contains filtered or unexported fields
}
ProtocolRegistry manages and dispatches to different protocol handlers
func NewProtocolRegistry ¶
func NewProtocolRegistry() *ProtocolRegistry
NewProtocolRegistry creates a new protocol registry
func (*ProtocolRegistry) Download ¶
func (pr *ProtocolRegistry) Download(ctx context.Context, urlStr string, options *types.DownloadOptions) (*types.DownloadStats, error)
Download performs a download using the appropriate protocol handler
func (*ProtocolRegistry) GetHandler ¶
func (pr *ProtocolRegistry) GetHandler(urlStr string) (ProtocolHandler, error)
GetHandler returns the appropriate handler for a given URL
func (*ProtocolRegistry) ListProtocols ¶
func (pr *ProtocolRegistry) ListProtocols() []string
ListProtocols returns a list of all registered protocol schemes
func (*ProtocolRegistry) Register ¶
func (pr *ProtocolRegistry) Register(handler ProtocolHandler) error
Register adds a protocol handler to the registry
func (*ProtocolRegistry) Unregister ¶
func (pr *ProtocolRegistry) Unregister(scheme string) error
Unregister removes a protocol handler from the registry
type S3Handler ¶
type S3Handler struct{}
S3Handler handles Amazon S3 protocol
type TorrentHandler ¶
type TorrentHandler struct{}
TorrentHandler handles torrent protocol
func (*TorrentHandler) CanHandle ¶
func (t *TorrentHandler) CanHandle(url string) bool
func (*TorrentHandler) Download ¶
func (t *TorrentHandler) Download(ctx context.Context, url string, options *types.DownloadOptions) (*types.DownloadStats, error)
func (*TorrentHandler) Scheme ¶
func (t *TorrentHandler) Scheme() string