protocols

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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

func (*S3Handler) CanHandle

func (s *S3Handler) CanHandle(url string) bool

func (*S3Handler) Download

func (s *S3Handler) Download(ctx context.Context, url string, options *types.DownloadOptions) (*types.DownloadStats, error)

func (*S3Handler) Scheme

func (s *S3Handler) Scheme() string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL