aria2go

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint, rpcSecret string, notifier Notifier) (*Client, error)

func (*Client) AddURI

func (c *Client) AddURI(uris []string, options ...any) (string, error)

AddURI https://aria2.github.io/manual/en/html/aria2c.html#aria2.addUri

func (*Client) GetGlobalStat

func (c *Client) GetGlobalStat() (stat GlobalStat, err error)

func (*Client) ListMethods

func (c *Client) ListMethods() (methods []string, err error)

func (*Client) TellStatus

func (c *Client) TellStatus(gid string, keys ...string) (statusInfo StatusInfo, err error)

TellStatus | active waiting paused error complete removed https://aria2.github.io/manual/en/html/aria2c.html#aria2.tellStatus

func (*Client) TellStopped

func (c *Client) TellStopped(offset, num int, keys ...string) (list []StatusInfo, err error)

type Event

type Event struct {
	Gid string `json:"gid"`
}

type GlobalStat

type GlobalStat struct {
	DownloadSpeed   string `json:"downloadSpeed"`
	NumActive       string `json:"numActive"`
	NumStopped      string `json:"numStopped"`
	NumStoppedTotal string `json:"numStoppedTotal"`
	NumWaiting      string `json:"numWaiting"`
	UploadSpeed     string `json:"uploadSpeed"`
}

type Notifier

type Notifier interface {
	OnDownloadStart([]Event)
	OnDownloadPause([]Event)
	OnDownloadStop([]Event)
	OnDownloadComplete([]Event)
	OnDownloadError([]Event)
	OnBtDownloadComplete([]Event)
}

Notifier handles rpc notification from aria2 server

type Option

type Option func(o *Client)

type StatusInfo

type StatusInfo struct {
	CompletedLength string `json:"completedLength"`
	Connections     string `json:"connections"`
	Dir             string `json:"dir"`
	DownloadSpeed   string `json:"downloadSpeed"`
	ErrorCode       string `json:"errorCode"`
	ErrorMessage    string `json:"errorMessage"`
	Files           []struct {
		CompletedLength string `json:"completedLength"`
		Index           string `json:"index"`
		Length          string `json:"length"`
		Path            string `json:"path"`
		Selected        string `json:"selected"`
		Uris            []struct {
			Status string `json:"status"`
			Uri    string `json:"uri"`
		} `json:"uris"`
	} `json:"files"`
	Gid          string `json:"gid"`
	NumPieces    string `json:"numPieces"`
	PieceLength  string `json:"pieceLength"`
	Status       string `json:"status"`
	TotalLength  string `json:"totalLength"`
	UploadLength string `json:"uploadLength"`
	UploadSpeed  string `json:"uploadSpeed"`
}

Jump to

Keyboard shortcuts

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