Versions in this module Expand all Collapse all v1 v1.0.0 Aug 24, 2026 Changes in this version + const DefaultEndpoint + const DefaultMaxResponseBytes + const DefaultNotificationBuffer + const NotificationBTDownloadComplete + const NotificationDownloadComplete + const NotificationDownloadError + const NotificationDownloadPause + const NotificationDownloadStart + const NotificationDownloadStop + var ErrClientClosed = errors.New("aria2g: WebSocket client is closed") + var ErrNotificationOverflow = errors.New("aria2g: WebSocket notification buffer is full") + var ErrResponseTooLarge = errors.New("aria2g: response exceeds configured size limit") + type BatchResult struct + Error *RPCError + Result json.RawMessage + func (r BatchResult) Decode(dst any) error + type Bitfield struct + Bitfield string + CompletedLength string + TotalLength string + type Bittorrent struct + AnnounceList [][]string + Comment string + CreationDate int64 + Info BittorrentInfo + Mode string + type BittorrentInfo struct + Name string + type Client struct + func DialWebSocket(ctx context.Context, endpoint, secret string) (*Client, error) + func DialWebSocketWithConfig(ctx context.Context, cfg Config) (*Client, error) + func New(endpoint, secret string) (*Client, error) + func NewWithConfig(cfg Config) (*Client, error) + func (c *Client) AddMetalink(ctx context.Context, metalink string, options Options, position *int) ([]string, error) + func (c *Client) AddTorrent(ctx context.Context, torrent string, uris []string, options Options, ...) (string, error) + func (c *Client) AddURI(ctx context.Context, uris []string, options Options, position *int) (string, error) + func (c *Client) Batch(ctx context.Context, calls []MethodCall) ([]BatchResult, error) + func (c *Client) Call(ctx context.Context, method string, result any, params ...any) error + func (c *Client) ChangeGlobalOption(ctx context.Context, options Options) error + func (c *Client) ChangeOption(ctx context.Context, gid string, options Options) error + func (c *Client) ChangePosition(ctx context.Context, gid string, pos int, how PositionMode) (int, error) + func (c *Client) ChangeURI(ctx context.Context, gid string, fileIndex int, del, add []string, ...) ([2]int, error) + func (c *Client) Close() error + func (c *Client) Endpoint() string + func (c *Client) ForcePause(ctx context.Context, gid string) (string, error) + func (c *Client) ForcePauseAll(ctx context.Context) error + func (c *Client) ForceRemove(ctx context.Context, gid string) (string, error) + func (c *Client) ForceShutdown(ctx context.Context) 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) ([]Peer, error) + func (c *Client) GetPieceStat(ctx context.Context, gid string) (Bitfield, error) + func (c *Client) GetServers(ctx context.Context, gid string) ([]Server, error) + func (c *Client) GetSessionInfo(ctx context.Context) (SessionInfo, error) + func (c *Client) GetURIs(ctx context.Context, gid string, fileIndex int) ([]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 []MethodCall) ([]json.RawMessage, error) + func (c *Client) Notifications() <-chan Notification + func (c *Client) Pause(ctx context.Context, gid string) (string, error) + func (c *Client) PauseAll(ctx context.Context) error + func (c *Client) PurgeDownloadResult(ctx context.Context) 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) error + func (c *Client) Shutdown(ctx context.Context) error + func (c *Client) TellActive(ctx context.Context, keys []string) ([]Download, error) + func (c *Client) TellStatus(ctx context.Context, gid string, keys []string) (Download, error) + func (c *Client) TellStopped(ctx context.Context, offset, num int, keys []string) ([]Download, error) + func (c *Client) TellWaiting(ctx context.Context, offset, num int, keys []string) ([]Download, error) + func (c *Client) Unpause(ctx context.Context, gid string) (string, error) + func (c *Client) UnpauseAll(ctx context.Context) error + type Config struct + Endpoint string + HTTPClient *http.Client + MaxResponseBytes int64 + NotificationBuffer int + Secret string + TLSConfig *tls.Config + Timeout time.Duration + type Download struct + BelongsTo string + Bitfield string + Bittorrent *Bittorrent + CompletedLength string + Connections string + Dir string + DownloadSpeed string + ErrorCode string + ErrorMessage string + Files []File + FollowedBy []string + Following string + GID string + InfoHash string + NumPieces string + NumSeeders string + PieceLength string + Seeder string + Status string + TotalLength string + UploadLength string + UploadSpeed string + VerifiedLength string + VerifyIntegrityPending string + type Event struct + GID string + type File struct + CompletedLength string + Index string + Length string + Path string + Selected string + URIs []URI + type GlobalStat struct + DownloadSpeed string + NumActive string + NumStopped string + NumStoppedTotal string + NumWaiting string + UploadSpeed string + type HTTPError struct + Body string + Status string + StatusCode int + func (e *HTTPError) Error() string + type MethodCall struct + Method string + Params []any + type Notification struct + Method string + Params json.RawMessage + func (n Notification) DecodeEvent() (Event, error) + type Options map[string]any + type Peer struct + AmChoking string + Bitfield string + DownloadSpeed string + IP string + PeerChoking string + PeerID string + Port string + Seeder string + UploadSpeed string + type PositionMode string + const PositionCurrent + const PositionEnd + const PositionSet + type RPCError struct + Code int + Data json.RawMessage + Message string + func (e *RPCError) Error() string + type Server struct + Index string + Servers []ServerInfo + type ServerInfo struct + CurrentURI string + DownloadSpeed string + URI string + type SessionInfo struct + SessionID string + type URI struct + Status string + URI string + type Version struct + EnabledFeatures []string + Version string