argo

package module
Version: v0.0.0-...-a6ec481 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2017 License: MIT Imports: 2 Imported by: 8

README

Aria2 RPC in Go

This is a wrapper to command aria2 (https://aria2.github.io) from Go.

Example and documentation on godoc: GoDoc

Go Report Card Build Status

This is a fork of https://github.com/zyxar/argo

Install

go get github.com/oliverpool/argo/...

Documentation

Overview

Package argo is a library to communicate with an aria2 (https://aria2.github.io/) daemon in Go.

Example
package main

import (
	"fmt"
	"os"
	"time"

	"github.com/oliverpool/argo/daemon"
	"github.com/oliverpool/argo/rpc/http"
)

func main() {
	// Error check omitted for concision
	// Start the daemon (without blocking)
	cmd := daemon.New().Cmd()
	cmd.Start()

	fmt.Println("Waiting for daemon to listen")
	for !daemon.IsRunningOn(":6800") {
		time.Sleep(time.Second)
	}

	// client to send commands (argo.rpc.http subpackage)
	client := http.NewClient("http://localhost:6800/jsonrpc", "")
	defer client.Close()

	uri := []string{"http://example.com/"}
	_, err := client.AddURI(uri)
	if err != nil {
		panic(err)
	}
	fmt.Println("URI added")

	// let some time for the download
	time.Sleep(time.Second)

	// ask the daemon to shutdown (and wait for its completion)
	client.Shutdown()
	cmd.Wait()

	// remove the downloaded file
	os.Remove("index.html")

}
Output:

Waiting for daemon to listen
URI added

Index

Examples

Constants

View Source
const (
	// RelativeToBeginning moves the download to a position relative to the beginning of the queue
	RelativeToBeginning = PositionStrategy("POS_SET")
	// RelativeToCurrent moves the download to a position relative to the current position.
	RelativeToCurrent = PositionStrategy("POS_CUR")
	// RelativeToEnd moves the download to a position relative to the end of the queue.
	RelativeToEnd = PositionStrategy("POS_END")
)
View Source
const (
	// ErrConnIsClosed happens when a connection is closed
	ErrConnIsClosed = ErrorString("connection is closed")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller interface {
	Call(method string, reply interface{}, params ...interface{}) error
	CallWithID(method string, reply interface{}, id *string, params ...interface{}) error
	Close() error
}

Caller allows to perform requests to an aria2 instance

type Client

type Client struct {
	Caller Caller
}

A Client is an aria2 client (https://aria2.github.io/)

It can be constructed with the http.NewClient method of the subpackage argo/rpc/http

func (c Client) AddMetalink(content []byte, options ...Option) (reply GIDs, err error)

AddMetalink adds a Metalink download by uploading a ".metalink" file. metalink is a base64-encoded string which contains the contents of the ".metalink" file. This method returns an array of GIDs of newly registered downloads. If --rpc-save-upload-metadata is true, the uploaded data is saved as a file named hex string of SHA-1 hash of data plus ".metalink" in the directory specified by --dir option. E.g. a file name might be 0a3893293e27ac0490424c06de4d09242215f0a6.metalink. If a file with the same name already exists, it is overwritten! If the file cannot be saved successfully or --rpc-save-upload-metadata is false, the downloads added by this method are not saved by --save-session.

func (Client) AddTorrent

func (c Client) AddTorrent(content []byte, options ...Option) (reply GIDwithID, err error)

AddTorrent adds a BitTorrent download by uploading the content of a ".torrent" file. If you want to add a BitTorrent Magnet URI, use the AddUri() method instead. This method returns the GID of the newly registered download If --rpc-save-upload-metadata is true, the uploaded data is saved as a file named as the hex string of SHA-1 hash of data plus ".torrent" in the directory specified by --dir option. E.g. a file name might be 0a3893293e27ac0490424c06de4d09242215f0a6.torrent. If a file with the same name already exists, it is overwritten! If the file cannot be saved successfully or --rpc-save-upload-metadata is false, the downloads added by this method are not saved by --save-session.

func (Client) AddTorrentWithWebSeed

func (c Client) AddTorrentWithWebSeed(content []byte, uris []string, options ...Option) (reply GIDwithID, err error)

AddTorrentWithWebSeed adds a BitTorrent download by uploading the content of a ".torrent" file. If you want to add a BitTorrent Magnet URI, use the AddUri() method instead. uris is an array of URIs (string). uris is used for Web-seeding. For single file torrents, the URI can be a complete URI pointing to the resource; if URI ends with /, name in torrent file is added. For multi-file torrents, name and path in torrent are added to form a URI for each file. This method returns the GID of the newly registered download If --rpc-save-upload-metadata is true, the uploaded data is saved as a file named as the hex string of SHA-1 hash of data plus ".torrent" in the directory specified by --dir option. E.g. a file name might be 0a3893293e27ac0490424c06de4d09242215f0a6.torrent. If a file with the same name already exists, it is overwritten! If the file cannot be saved successfully or --rpc-save-upload-metadata is false, the downloads added by this method are not saved by --save-session.

func (Client) AddURI

func (c Client) AddURI(uris []string, options ...Option) (reply GIDwithID, err error)

AddURI adds a new download - uris is an array of HTTP/FTP/SFTP/BitTorrent URIs (strings) pointing to the same resource. If you mix URIs pointing to different resources, then the download may fail or be corrupted without aria2 complaining. When adding BitTorrent Magnet URIs, uris must have only one element and it should be BitTorrent Magnet URI. options is a struct and its members are pairs of option name and value. This method returns the GID of the newly registered download.

func (Client) ChangeGlobalOption

func (c Client) ChangeGlobalOption(options ...Option) (reply Ok, err error)

ChangeGlobalOption changes global options dynamically.

The following options are available:

bt-max-open-files download-result keep-unfinished-download-result log log-level max-concurrent-downloads max-download-result max-overall-download-limit max-overall-upload-limit optimize-concurrent-downloads save-cookies save-session server-stat-of

In addition, options listed in the Input File subsection are available, except for following options: checksum index-out out pause select-file

With the log option, you can dynamically start logging or change log file. To stop logging, specify an empty string("") as the parameter value. Note that log file is always opened in append mode.

func (Client) ChangeOption

func (c Client) ChangeOption(gid GID, options ...Option) (reply Ok, err error)

ChangeOption changes options of the download denoted by gid (string) dynamically.

The options listed in Input File subsection are available, except for following options: dry-run metalink-base-uri parameterized-uri pause piece-length rpc-save-upload-metadata

Except for the following options, changing the other options of active download makes it restart (restart itself is managed by aria2, and no user intervention is required): bt-max-peers bt-request-peer-speed-limit bt-remove-unselected-file force-save max-download-limit max-upload-limit

This method returns OK for success.

func (Client) ChangePosition

func (c Client) ChangePosition(gid GID, pos int, strategy PositionStrategy) (reply NewPosition, err error)

ChangePosition changes the position of the download denoted by gid in the queue. pos is an integer. strategy is a PositionStrategy. If the destination position is less than 0 or beyond the end of the queue, it moves the download to the beginning or the end of the queue respectively. The response is an integer denoting the resulting position.

func (Client) ChangeURI

func (c Client) ChangeURI(gid GID, fileIndex int, delURIs, addURIs []string) (reply DeletionAddition, err error)

ChangeURI removes the URIs in delUris from and appends the URIs in addUris to download denoted by gid. delUris and addUris are lists of strings. A download can contain multiple files and URIs are attached to each file. fileIndex is used to select which file to remove/attach given URIs. fileIndex is 1-based. URIs are appended to the back of the list (to choose position, see ChangeURIWithPosition). When removing an URI, if the same URIs exist in download, only one of them is removed for each URI in delUris. In other words, if there are three URIs http://example.org/aria2 and you want remove them all, you have to specify (at least) 3 http://example.org/aria2 in delUris. This method returns a list which contains two integers. The first integer is the number of URIs deleted. The second integer is the number of URIs added.

func (Client) ChangeURIWithPosition

func (c Client) ChangeURIWithPosition(gid GID, fileIndex int, delURIs, addURIs []string, position int) (reply DeletionAddition, err error)

ChangeURIWithPosition removes the URIs in delUris from and appends the URIs in addUris to download denoted by gid. delUris and addUris are lists of strings. A download can contain multiple files and URIs are attached to each file. fileIndex is used to select which file to remove/attach given URIs. fileIndex is 1-based. position is used to specify where URIs are inserted in the existing waiting URI list. position is 0-based. To append URIs to the back of the list, see ChangeURI. This method first executes the removal and then the addition. position is the position after URIs are removed, not the position when this method is called. When removing an URI, if the same URIs exist in download, only one of them is removed for each URI in delUris. In other words, if there are three URIs http://example.org/aria2 and you want remove them all, you have to specify (at least) 3 http://example.org/aria2 in delUris. This method returns a list which contains two integers. The first integer is the number of URIs deleted. The second integer is the number of URIs added.

func (Client) Close

func (c Client) Close() (err error)

Close gracefully closes the Caller

func (Client) ForcePause

func (c Client) ForcePause(gid GID) (reply GID, err error)

ForcePause behaves just like Pause() except that this method pauses downloads without performing any actions which take time, such as contacting BitTorrent trackers to unregister the download first. This method returns GID of removed download.

func (Client) ForcePauseAll

func (c Client) ForcePauseAll() (reply Ok, err error)

ForcePauseAll is equal to calling ForcePause() for every active/waiting download. This methods returns OK.

func (Client) ForceRemove

func (c Client) ForceRemove(gid GID) (reply GID, err error)

ForceRemove the download denoted by gid. This method behaves just like Remove() except that this method removes the download without performing any actions which take time, such as contacting BitTorrent trackers to unregister the download first.

func (Client) ForceShutdown

func (c Client) ForceShutdown() (reply Ok, err error)

ForceShutdown shuts down aria2. This method behaves like Shutdown without performing any actions which take time, such as contacting BitTorrent trackers to unregister downloads first.

func (Client) GetFiles

func (c Client) GetFiles(gid GID) (reply []FileInfo, err error)

GetFiles returns the URIs used in the download denoted by gid (string).

func (Client) GetGlobalOption

func (c Client) GetGlobalOption() (reply Option, err error)

GetGlobalOption returns the global options.

The response is a struct. Its keys are the names of options. Values are strings.

Note that this method does not return options which have no default value and have not been set on the command-line, in configuration files or RPC methods. Because global options are used as a template for the options of newly added downloads, the response contains keys returned by the GetOption() method.

func (Client) GetGlobalStat

func (c Client) GetGlobalStat() (reply GlobalStatInfo, err error)

GetGlobalStat returns global statistics such as the overall download and upload speeds.

func (Client) GetOption

func (c Client) GetOption(gid GID) (reply Option, err error)

GetOption returns options of the download denoted by gid. The response is a struct where keys are the names of options. Note that this method does not return options which have no default value and have not been set on the command-line, in configuration files or RPC methods.

func (Client) GetPeers

func (c Client) GetPeers(gid GID) (reply []PeerInfo, err error)

GetPeers returns a list peers of the download denoted by gid (string). This method is for BitTorrent only.

func (Client) GetServers

func (c Client) GetServers(gid GID) (reply []ServerInfo, err error)

GetServers returns currently connected HTTP(S)/FTP/SFTP servers of the download denoted by gid (string).

func (Client) GetSessionInfo

func (c Client) GetSessionInfo() (reply SessionInfo, err error)

GetSessionInfo returns session information.

func (Client) GetURIs

func (c Client) GetURIs(gid GID) (reply []URIInfo, err error)

GetURIs returns the URIs used in the download denoted by gid (string).

func (Client) GetVersion

func (c Client) GetVersion() (reply VersionInfo, err error)

GetVersion returns the version of aria2 and the list of enabled features.

func (Client) ListMethods

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

ListMethods returns all the available RPC methods .

func (Client) ListNotifications

func (c Client) ListNotifications() (reply []string, err error)

ListNotifications returns all the available RPC notifications

func (Client) Pause

func (c Client) Pause(gid GID) (reply GID, err error)

Pause the download denoted by gid (string). The status of paused download becomes paused. If the download was active, the download is placed in the front of waiting queue. While the status is paused, the download is not started. To change status to waiting, use the Unpause() method. This method returns GID of removed download.

func (Client) PauseAll

func (c Client) PauseAll() (reply Ok, err error)

PauseAll is equal to calling Pause() for every active/waiting download. This methods returns OK.

func (Client) PurgeDownloadResult

func (c Client) PurgeDownloadResult() (reply Ok, err error)

PurgeDownloadResult purges completed/error/removed downloads to free memory.

func (Client) Remove

func (c Client) Remove(gid GID) (reply GID, err error)

Remove the download denoted by gid (string). If the specified download is in progress, it is first stopped. The status of the removed download becomes removed. This method returns GID of removed download.

func (Client) RemoveDownloadResult

func (c Client) RemoveDownloadResult(gid GID) (reply Ok, err error)

RemoveDownloadResult removes a completed/error/removed download denoted by gid from memory.

func (Client) SaveSession

func (c Client) SaveSession() (reply Ok, err error)

SaveSession saves the current session to a file specified by the --save-session option.

func (Client) Shutdown

func (c Client) Shutdown() (reply Ok, err error)

Shutdown shuts down aria2.

func (Client) TellActive

func (c Client) TellActive(keys ...string) (reply []StatusInfo, err error)

TellActive returns a list of active downloads. For the keys parameter, please refer to the aria2.tellStatus() method.

func (Client) TellStatus

func (c Client) TellStatus(gid GID, keys ...string) (reply StatusInfo, err error)

TellStatus returns the URIs used in the download denoted by gid (string). keys is an array of strings. If specified, the response contains only keys in the keys array. If keys is empty or omitted, the response contains all keys. This is useful when you just want specific keys and avoid unnecessary transfers.

func (Client) TellStopped

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

TellStopped returns a list of stopped downloads. offset is an integer and specifies the offset from the least recently stopped download. num is an integer and specifies the max. number of downloads to be returned.

For the keys parameter, please refer to the TellStatus() method.

offset and num have the same semantics as described in the TellWaiting() method.

func (Client) TellWaiting

func (c Client) TellWaiting(offset int, num int, keys ...string) (reply []StatusInfo, err error)

TellWaiting returns list of waiting downloads, including paused ones. offset is an integer and specifies the offset from the download waiting at the front. num is an integer and specifies the max. number of downloads to be returned. For the keys parameter, please refer to the TellStatus() method.

If offset is a positive integer, this method returns downloads in the range of [offset, offset + num).

offset can be a negative integer. offset == -1 points last download in the waiting queue and offset == -2 points the download before the last download, and so on. Downloads in the response are in reversed order then.

For example, imagine three downloads "A","B" and "C" are waiting in this order. TellWaiting(0, 1) returns ["A"]. TellWaiting(1, 2) returns ["B", "C"]. TellWaiting(-1, 2) returns ["C", "B"].

func (Client) Unpause

func (c Client) Unpause(gid GID) (reply GID, err error)

Unpause changes the status of the download denoted by gid (string) from paused to waiting, making the download eligible to be restarted. This method returns GID of removed download.

func (Client) UnpauseAll

func (c Client) UnpauseAll() (reply Ok, err error)

UnpauseAll is equal to calling Unpause() for every active/waiting download. This methods returns OK.

type DeletionAddition

type DeletionAddition []int

DeletionAddition is a result of ChangeURI The first integer is the number of URIs deleted. The second integer is the number of URIs added.

type ErrorString

type ErrorString string

ErrorString of the argo package

func (ErrorString) Error

func (e ErrorString) Error() string

type FileInfo

type FileInfo struct {
	Index           string    `json:"index"`     // Index of the file, starting at 1, in the same order as files appear in the multi-file torrent.
	Path            string    `json:"path"`      // File path.
	Length          string    `json:"length"`    // File size in bytes.
	CompletedLength string    `json:"completed"` // Completed length of this file in bytes. Please note that it is possible that sum of completedLength is less than the completedLength returned by the aria2.tellStatus() method. This is because completedLength in aria2.getFiles() only includes completed pieces. On the other hand, completedLength in aria2.tellStatus() also includes partially completed pieces.
	Selected        string    `json:"selected"`  // true if this file is selected by --select-file option. If --select-file is not specified or this is single-file torrent or not a torrent download at all, this value is always true. Otherwise false.
	URIs            []URIInfo `json:"uris"`      // Returns a list of URIs for this file. The element type is the same struct used in the aria2.getUris() method.
}

FileInfo represents an element of response of aria2.getFiles

type GID

type GID string

GID is the identifier aria2 uses for each download. The GID is hex string of 16 characters, thus [0-9a-zA-Z] are allowed and leading zeros must not be stripped. The GID all 0 is reserved and must not be used. The GID must be unique, otherwise error is reported and the download is not added.

func (GID) String

func (g GID) String() string

String returns the value as string

type GIDs

type GIDs struct {
	GIDs []GID
	ID   string `json:"id"`
}

GIDs (and ID of the call) of the affected downloads.

type GIDwithID

type GIDwithID struct {
	GID GID
	ID  string `json:"id"`
}

GIDwithID contains the GID and the ID of the affected download.

type GlobalStatInfo

type GlobalStatInfo struct {
	DownloadSpeed   string `json:"downloadSpeed"`   // Overall download speed (byte/sec).
	UploadSpeed     string `json:"uploadSpeed"`     // Overall upload speed(byte/sec).
	NumActive       string `json:"numActive"`       // The number of active downloads.
	NumWaiting      string `json:"numWaiting"`      // The number of waiting downloads.
	NumStopped      string `json:"numStopped"`      // The number of stopped downloads in the current session. This value is capped by the --max-download-result option.
	NumStoppedTotal string `json:"numStoppedTotal"` // The number of stopped downloads in the current session and not capped by the --max-download-result option.
}

GlobalStatInfo represents response of aria2.getGlobalStat

type NewPosition

type NewPosition int

NewPosition denotes the resulting position from the ChangePosition method

type Notification

type Notification interface {
	Identifier() string
	GID() []GID // GID of the downloads
}

Notification from aria2

type NotificationEmitter

type NotificationEmitter interface {
	Emit() (Notification, error)
}

NotificationEmitter emits Notifications

It can be constructed with the websocket.NewEmitter method of the subpackage argo/rpc/websocket

type NotificationFullHandler

type NotificationFullHandler interface {
	NotificationHandler
	Started([]GID)
	Paused([]GID)
	Stopped([]GID)
	Completed([]GID)
	BtCompleted([]GID)
	Error([]GID)
	Unknown(identifier string, GID []GID)
}

NotificationFullHandler can handle all notifications

type NotificationHandler

type NotificationHandler interface {
	ReceptionError(error) bool // if true, stop receiving notifications (for instance on ErrConnIsClosed)
}

NotificationHandler must handle (at least) notifications errors (during communication or decoding). It may also handle some of the other notifications of the NotificationFullHandler

It can be used with the notification.Forward method of the argo/notification subpackage

type Ok

type Ok string

Ok is the reply of global methods (not acting on one specific download)

func (Ok) Success

func (o Ok) Success() bool

Success returns if the call was successful

type Option

type Option map[string]interface{}

Option allows to pass custom options

See the option subpackage

func (Option) GetID

func (o Option) GetID() string

GetID returns the "id" value if present (empty string otherwise)

func (Option) GetPosition

func (o Option) GetPosition() (int, bool)

GetPosition returns the "position" value if present

type PeerInfo

type PeerInfo struct {
	PeerID        string `json:"peerId"`        // Percent-encoded peer ID.
	IP            string `json:"ip"`            // IP address of the peer.
	Port          string `json:"port"`          // Port number of the peer.
	BitField      string `json:"bitfield"`      // Hexadecimal representation of the download progress of the peer. The highest bit corresponds to the piece at index 0. Set bits indicate the piece is available and unset bits indicate the piece is missing. Any spare bits at the end are set to zero.
	AmChoking     string `json:"amChoking"`     // true if aria2 is choking the peer. Otherwise false.
	PeerChoking   string `json:"peerChoking"`   // true if the peer is choking aria2. Otherwise false.
	DownloadSpeed string `json:"downloadSpeed"` // Download speed (byte/sec) that this client obtains from the peer.
	UploadSpeed   string `json:"uploadSpeed"`   // Upload speed(byte/sec) that this client uploads to the peer.
	Seeder        string `json:"seeder"`        // true if this peer is a seeder. Otherwise false.
}

PeerInfo represents an element of response of aria2.getPeers

type PositionStrategy

type PositionStrategy string

PositionStrategy describe the positioning strategy. See RelativeToBeginning, RelativeToCurrent, RelativeToEnd

type ResponseError

type ResponseError struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

ResponseError indicates the error encountered

func (ResponseError) Error

func (r ResponseError) Error() string

type ServerInfo

type ServerInfo struct {
	Index   string `json:"index"` // Index of the file, starting at 1, in the same order as files appear in the multi-file metalink.
	Servers []struct {
		URI           string `json:"uri"`           // Original URI.
		CurrentURI    string `json:"currentUri"`    // This is the URI currently used for downloading. If redirection is involved, currentUri and uri may differ.
		DownloadSpeed string `json:"downloadSpeed"` // Download speed (byte/sec)
	} `json:"servers"` // A list of structs which contain the following keys.
}

ServerInfo represents an element of response of aria2.getServers

type SessionInfo

type SessionInfo struct {
	SessionID string `json:"sessionId"` // Session ID, which is generated each time when aria2 is invoked.
}

SessionInfo represents response of aria2.getSessionInfo

type StatusInfo

type StatusInfo struct {
	Gid             string     `json:"gid"`             // GID of the download.
	Status          string     `json:"status"`          // active for currently downloading/seeding downloads. waiting for downloads in the queue; download is not started. paused for paused downloads. error for downloads that were stopped because of error. complete for stopped and completed downloads. removed for the downloads removed by user.
	TotalLength     string     `json:"totalLength"`     // Total length of the download in bytes.
	CompletedLength string     `json:"completedLength"` // Completed length of the download in bytes.
	UploadLength    string     `json:"uploadLength"`    // Uploaded length of the download in bytes.
	BitField        string     `json:"bitfield"`        // Hexadecimal representation of the download progress. The highest bit corresponds to the piece at index 0. Any set bits indicate loaded pieces, while unset bits indicate not yet loaded and/or missing pieces. Any overflow bits at the end are set to zero. When the download was not started yet, this key will not be included in the response.
	DownloadSpeed   string     `json:"downloadSpeed"`   // Download speed of this download measured in bytes/sec.
	UploadSpeed     string     `json:"uploadSpeed"`     // Upload speed of this download measured in bytes/sec.
	InfoHash        string     `json:"infoHash"`        // InfoHash. BitTorrent only.
	NumSeeders      string     `json:"numSeeders"`      // The number of seeders aria2 has connected to. BitTorrent only.
	Seeder          string     `json:"seeder"`          // true if the local endpoint is a seeder. Otherwise false. BitTorrent only.
	PieceLength     string     `json:"pieceLength"`     // Piece length in bytes.
	NumPieces       string     `json:"numPieces"`       // The number of pieces.
	Connections     string     `json:"connections"`     // The number of peers/servers aria2 has connected to.
	ErrorCode       string     `json:"errorCode"`       // The code of the last error for this item, if any. The value is a string. The error codes are defined in the EXIT STATUS section. This value is only available for stopped/completed downloads.
	ErrorMessage    string     `json:"errorMessage"`    // The (hopefully) human readable error message associated to errorCode.
	FollowedBy      []string   `json:"followedBy"`      // List of GIDs which are generated as the result of this download. For example, when aria2 downloads a Metalink file, it generates downloads described in the Metalink (see the --follow-metalink option). This value is useful to track auto-generated downloads. If there are no such downloads, this key will not be included in the response.
	BelongsTo       string     `json:"belongsTo"`       // GID of a parent download. Some downloads are a part of another download. For example, if a file in a Metalink has BitTorrent resources, the downloads of ".torrent" files are parts of that parent. If this download has no parent, this key will not be included in the response.
	Dir             string     `json:"dir"`             // Directory to save files.
	Files           []FileInfo `json:"files"`           // Returns the list of files. The elements of this list are the same structs used in aria2.getFiles() method.
	BitTorrent      struct {
		AnnounceList string `json:"announceList"` // List of lists of announce URIs. If the torrent contains announce and no announce-list, announce is converted to the announce-list format.
		Comment      string `json:"comment"`      // The comment of the torrent. comment.utf-8 is used if available.
		CreationDate string `json:"creationDate"` // The creation time of the torrent. The value is an integer since the epoch, measured in seconds.
		Mode         string `json:"mode"`         // File mode of the torrent. The value is either single or multi.
		Info         struct {
			Name string `json:"name"` // name in info dictionary. name.utf-8 is used if available.
		} `json:"info"` // Struct which contains data from Info dictionary. It contains following keys.
	} `json:"bittorrent"` // Struct which contains information retrieved from the .torrent (file). BitTorrent only. It contains following keys.
}

StatusInfo represents response of aria2.tellStatus

type URIInfo

type URIInfo struct {
	URI    string `json:"uri"`    // URI
	Status string `json:"status"` // 'used' if the URI is in use. 'waiting' if the URI is still waiting in the queue.
}

URIInfo represents an element of response of aria2.getUris

type VersionInfo

type VersionInfo struct {
	Version  string   `json:"version"`         // Version number of aria2 as a string.
	Features []string `json:"enabledFeatures"` // List of enabled features. Each feature is given as a string.
}

VersionInfo represents response of aria2.getVersion

Directories

Path Synopsis
cmd
Package daemon simplifies the configuration of the aria2c daemon
Package daemon simplifies the configuration of the aria2c daemon
Package notification allows to forward notifications from an Emitter to a Handler
Package notification allows to forward notifications from an Emitter to a Handler
Package option gathers some of the options that the aria2 client (and the daemon) may take in argument.
Package option gathers some of the options that the aria2 client (and the daemon) may take in argument.
rpc
Package rpc handles the rpc communication with the aria2 dameon
Package rpc handles the rpc communication with the aria2 dameon
http
Package http implements http communication with the aria2 daemon
Package http implements http communication with the aria2 daemon
websocket
Package websocket implements websocket communication with the aria2 daemon
Package websocket implements websocket communication with the aria2 daemon

Jump to

Keyboard shortcuts

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