Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) AddMetalink(ctx context.Context, metalink []byte, options Options) ([]string, error)
- func (c *Client) AddTorrent(ctx context.Context, torrent []byte, uris []string, options Options) (string, error)
- func (c *Client) AddURI(ctx context.Context, uris []string, options Options) (string, error)
- func (c *Client) ChangeGlobalOption(ctx context.Context, options Options) (string, error)
- func (c *Client) ChangeOption(ctx context.Context, gid string, options Options) (string, error)
- func (c *Client) ChangePosition(ctx context.Context, gid string, pos int, how string) (int, error)
- func (c *Client) ChangeURI(ctx context.Context, gid string, fileIndex int, delURIs []string, ...) ([]int, error)
- func (c *Client) ForcePause(ctx context.Context, gid string) (string, error)
- func (c *Client) ForcePauseAll(ctx context.Context) (string, error)
- func (c *Client) ForceRemove(ctx context.Context, gid string) (string, error)
- func (c *Client) ForceShutdown(ctx context.Context) (string, error)
- func (c *Client) GetFiles(ctx context.Context, gid string) ([]File, error)
- func (c *Client) GetGlobalOption(ctx context.Context) (Options, error)
- func (c *Client) GetGlobalStat(ctx context.Context) (*GlobalStat, error)
- func (c *Client) GetOption(ctx context.Context, gid string) (Options, error)
- func (c *Client) GetPeers(ctx context.Context, gid string) ([]any, error)
- func (c *Client) GetServers(ctx context.Context, gid string) ([]any, error)
- func (c *Client) GetSessionInfo(ctx context.Context) (map[string]any, error)
- func (c *Client) GetURIs(ctx context.Context, gid string) ([]URI, error)
- func (c *Client) GetVersion(ctx context.Context) (*Version, error)
- func (c *Client) ListMethods(ctx context.Context) ([]string, error)
- func (c *Client) ListNotifications(ctx context.Context) ([]string, error)
- func (c *Client) MultiCall(ctx context.Context, calls []map[string]any) ([]any, error)
- func (c *Client) Pause(ctx context.Context, gid string) (string, error)
- func (c *Client) PauseAll(ctx context.Context) (string, error)
- func (c *Client) PurgeDownloadResult(ctx context.Context) (string, error)
- func (c *Client) Remove(ctx context.Context, gid string) (string, error)
- func (c *Client) RemoveDownloadResult(ctx context.Context, gid string) (string, error)
- func (c *Client) SaveSession(ctx context.Context) (string, error)
- func (c *Client) Shutdown(ctx context.Context) (string, error)
- func (c *Client) TellActive(ctx context.Context, keys ...string) ([]Status, error)
- func (c *Client) TellStatus(ctx context.Context, gid string, keys ...string) (*Status, error)
- func (c *Client) TellStopped(ctx context.Context, offset, num int, keys ...string) ([]Status, error)
- func (c *Client) TellWaiting(ctx context.Context, offset, num int, keys ...string) ([]Status, error)
- func (c *Client) Unpause(ctx context.Context, gid string) (string, error)
- func (c *Client) UnpauseAll(ctx context.Context) (string, error)
- type File
- type GlobalStat
- type Options
- type Status
- type URI
- type Version
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an aria2 JSON-RPC client
func NewClient ¶
NewClient creates a new aria2 client url: aria2 RPC URL (e.g., "http://localhost:6800/jsonrpc") secret: aria2 RPC secret token (optional, use empty string if not set)
func NewClientWithHTTPClient ¶
NewClientWithHTTPClient creates a new aria2 client with custom HTTP client
func (*Client) AddMetalink ¶
func (c *Client) AddMetalink(ctx context.Context, metalink []byte, options Options) ([]string, error)
AddMetalink adds a new download with metalink file content
func (*Client) AddTorrent ¶
func (c *Client) AddTorrent(ctx context.Context, torrent []byte, uris []string, options Options) (string, error)
AddTorrent adds a new download with torrent file content
func (*Client) ChangeGlobalOption ¶
ChangeGlobalOption changes global options dynamically
func (*Client) ChangeOption ¶
ChangeOption changes options of the download denoted by gid dynamically
func (*Client) ChangePosition ¶
ChangePosition changes the position of the download denoted by gid
func (*Client) ChangeURI ¶
func (c *Client) ChangeURI(ctx context.Context, gid string, fileIndex int, delURIs []string, addURIs []string) ([]int, error)
ChangeURI changes the URI of the download denoted by gid
func (*Client) ForcePause ¶
ForcePause pauses the download denoted by gid forcefully
func (*Client) ForcePauseAll ¶
ForcePauseAll pauses all downloads forcefully
func (*Client) ForceRemove ¶
ForceRemove removes the download denoted by gid forcefully
func (*Client) ForceShutdown ¶
ForceShutdown shuts down aria2 forcefully
func (*Client) GetGlobalOption ¶
GetGlobalOption returns the global options
func (*Client) GetGlobalStat ¶
func (c *Client) GetGlobalStat(ctx context.Context) (*GlobalStat, error)
GetGlobalStat returns global statistics such as the overall download and upload speed
func (*Client) GetServers ¶
GetServers returns currently connected HTTP(S)/FTP/SFTP servers of the download denoted by gid
func (*Client) GetSessionInfo ¶
GetSessionInfo returns session information
func (*Client) GetVersion ¶
GetVersion returns the version of aria2 and the list of enabled features
func (*Client) ListMethods ¶
ListMethods lists all available RPC methods
func (*Client) ListNotifications ¶
ListNotifications lists all available RPC notifications
func (*Client) MultiCall ¶
MultiCall executes multiple method calls in a single request (system.multicall)
func (*Client) PurgeDownloadResult ¶
PurgeDownloadResult purges completed/error/removed downloads
func (*Client) RemoveDownloadResult ¶
RemoveDownloadResult removes a completed/error/removed download denoted by gid
func (*Client) SaveSession ¶
SaveSession saves the current session to a file
func (*Client) TellActive ¶
TellActive returns a list of active downloads
func (*Client) TellStatus ¶
TellStatus returns the progress of the download denoted by gid
func (*Client) TellStopped ¶
func (c *Client) TellStopped(ctx context.Context, offset, num int, keys ...string) ([]Status, error)
TellStopped returns a list of stopped downloads
func (*Client) TellWaiting ¶
func (c *Client) TellWaiting(ctx context.Context, offset, num int, keys ...string) ([]Status, error)
TellWaiting returns a list of waiting downloads
type File ¶
type File struct {
Index string `json:"index"`
Path string `json:"path"`
Length string `json:"length"`
CompletedLength string `json:"completedLength"`
Selected string `json:"selected"`
URIs []URI `json:"uris"`
}
File represents a file in the download
type GlobalStat ¶
type GlobalStat struct {
DownloadSpeed string `json:"downloadSpeed"`
UploadSpeed string `json:"uploadSpeed"`
NumActive string `json:"numActive"`
NumWaiting string `json:"numWaiting"`
NumStopped string `json:"numStopped"`
NumStoppedTotal string `json:"numStoppedTotal"`
}
GlobalStat represents global statistics
type Status ¶
type Status struct {
GID string `json:"gid"`
Status string `json:"status"`
TotalLength string `json:"totalLength"`
CompletedLength string `json:"completedLength"`
UploadLength string `json:"uploadLength"`
Bitfield string `json:"bitfield,omitempty"`
DownloadSpeed string `json:"downloadSpeed"`
UploadSpeed string `json:"uploadSpeed"`
InfoHash string `json:"infoHash,omitempty"`
NumSeeders string `json:"numSeeders,omitempty"`
Seeder string `json:"seeder,omitempty"`
PieceLength string `json:"pieceLength,omitempty"`
NumPieces string `json:"numPieces,omitempty"`
Connections string `json:"connections"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorMessage string `json:"errorMessage,omitempty"`
FollowedBy []string `json:"followedBy,omitempty"`
Following string `json:"following,omitempty"`
BelongsTo string `json:"belongsTo,omitempty"`
Dir string `json:"dir"`
Files []File `json:"files"`
BitTorrent struct {
AnnounceList [][]string `json:"announceList,omitempty"`
Comment string `json:"comment,omitempty"`
CreationDate int64 `json:"creationDate,omitempty"`
Mode string `json:"mode,omitempty"`
Info struct {
Name string `json:"name,omitempty"`
} `json:"info"`
} `json:"bittorrent"`
VerifiedLength string `json:"verifiedLength,omitempty"`
VerifyIntegrityPending string `json:"verifyIntegrityPending,omitempty"`
}
Status represents the status of a download
func (*Status) IsDownloadActive ¶
IsDownloadActive checks if the download is active
func (*Status) IsDownloadComplete ¶
IsDownloadComplete checks if the download is complete
func (*Status) IsDownloadError ¶
IsDownloadError checks if the download has an error
func (*Status) IsDownloadPaused ¶
IsDownloadPaused checks if the download is paused
func (*Status) IsDownloadRemoved ¶
IsDownloadRemoved checks if the download is removed
func (*Status) IsDownloadWaiting ¶
IsDownloadWaiting checks if the download is waiting