Documentation ¶
Index ¶
- Constants
- func File2Base64(filename string) (b64 string, err error)
- type AdvancedConfig
- type BandwidthGroup
- type BandwidthGroupSetPayload
- type Client
- func (c *Client) BandwidthGroupGet(ctx context.Context, fields []string, groups []string) (bandwidthGroups []BandwidthGroup, err error)
- func (c *Client) BandwidthGroupGetAll(ctx context.Context) (bandwidthGroups []BandwidthGroup, err error)
- func (c *Client) BandwidthGroupSet(ctx context.Context, payload BandwidthGroupSetPayload) (err error)
- func (c *Client) BlocklistUpdate(ctx context.Context) (nbEntries int64, err error)
- func (c *Client) FreeSpace(ctx context.Context, path string) (freeSpace cunits.Bits, err error)
- func (c *Client) PortTest(ctx context.Context) (open bool, err error)
- func (c *Client) QueueMoveBottom(ctx context.Context, IDs []int64) (err error)
- func (c *Client) QueueMoveDown(ctx context.Context, IDs []int64) (err error)
- func (c *Client) QueueMoveTop(ctx context.Context, IDs []int64) (err error)
- func (c *Client) QueueMoveUp(ctx context.Context, IDs []int64) (err error)
- func (c *Client) RPCVersion(ctx context.Context) (ok bool, serverVersion int64, serverMinimumVersion int64, err error)
- func (c *Client) SessionArgumentsGet(ctx context.Context, fields []string) (sessionArgs SessionArguments, err error)
- func (c *Client) SessionArgumentsGetAll(ctx context.Context) (sessionArgs SessionArguments, err error)
- func (c *Client) SessionArgumentsSet(ctx context.Context, payload SessionArguments) (err error)
- func (c *Client) SessionClose(ctx context.Context) (err error)
- func (c *Client) SessionStats(ctx context.Context) (stats SessionStats, err error)
- func (c *Client) TorrentAdd(ctx context.Context, payload TorrentAddPayload) (torrent Torrent, err error)
- func (c *Client) TorrentAddFile(ctx context.Context, filepath string) (torrent Torrent, err error)
- func (c *Client) TorrentAddFileDownloadDir(ctx context.Context, filepath, downloaddir string) (torrent Torrent, err error)
- func (c *Client) TorrentGet(ctx context.Context, fields []string, ids []int64) (torrents []Torrent, err error)
- func (c *Client) TorrentGetAll(ctx context.Context) (torrents []Torrent, err error)
- func (c *Client) TorrentGetAllFor(ctx context.Context, ids []int64) (torrents []Torrent, err error)
- func (c *Client) TorrentGetAllForHashes(ctx context.Context, hashes []string) (torrents []Torrent, err error)
- func (c *Client) TorrentGetHashes(ctx context.Context, fields []string, hashes []string) (torrents []Torrent, err error)
- func (c *Client) TorrentReannounceHashes(ctx context.Context, hashes []string) (err error)
- func (c *Client) TorrentReannounceIDs(ctx context.Context, ids []int64) (err error)
- func (c *Client) TorrentReannounceRecentlyActive(ctx context.Context) (err error)
- func (c *Client) TorrentRemove(ctx context.Context, payload TorrentRemovePayload) (err error)
- func (c *Client) TorrentRenamePath(ctx context.Context, id int64, path, name string) (err error)
- func (c *Client) TorrentRenamePathHash(ctx context.Context, hash, path, name string) (err error)
- func (c *Client) TorrentSet(ctx context.Context, payload TorrentSetPayload) (err error)
- func (c *Client) TorrentSetLocation(ctx context.Context, id int64, location string, move bool) (err error)
- func (c *Client) TorrentSetLocationHash(ctx context.Context, hash, location string, move bool) (err error)
- func (c *Client) TorrentStartHashes(ctx context.Context, hashes []string) (err error)
- func (c *Client) TorrentStartIDs(ctx context.Context, ids []int64) (err error)
- func (c *Client) TorrentStartNowHashes(ctx context.Context, hashes []string) (err error)
- func (c *Client) TorrentStartNowIDs(ctx context.Context, ids []int64) (err error)
- func (c *Client) TorrentStartNowRecentlyActive(ctx context.Context) (err error)
- func (c *Client) TorrentStartRecentlyActive(ctx context.Context) (err error)
- func (c *Client) TorrentStopHashes(ctx context.Context, hashes []string) (err error)
- func (c *Client) TorrentStopIDs(ctx context.Context, ids []int64) (err error)
- func (c *Client) TorrentStopRecentlyActive(ctx context.Context) (err error)
- func (c *Client) TorrentVerifyHashes(ctx context.Context, hashes []string) (err error)
- func (c *Client) TorrentVerifyIDs(ctx context.Context, ids []int64) (err error)
- func (c *Client) TorrentVerifyRecentlyActive(ctx context.Context) (err error)
- type CumulativeStats
- type CurrentStats
- type HTTPStatusCode
- type Peer
- type SeedRatioMode
- type SessionArguments
- type SessionStats
- type Torrent
- type TorrentAddPayload
- type TorrentFile
- type TorrentFileStat
- type TorrentPeersFrom
- type TorrentRemovePayload
- type TorrentSetPayload
- type TorrentStatus
- type Tracker
- type TrackerStats
- type TransmissionFreeSpace
- type Units
Constants ¶
const (
// RPCVersion indicates the exact transmission RPC version this library is build against
RPCVersion = 17
)
Variables ¶
This section is empty.
Functions ¶
func File2Base64 ¶
File2Base64 returns the base64 encoding of the file provided by filename. This can then be passed as MetaInfo in TorrentAddPayload.
Types ¶
type AdvancedConfig ¶
type AdvancedConfig struct { HTTPS bool Port uint16 RPCURI string HTTPTimeout time.Duration UserAgent string Debug bool }
AdvancedConfig handles options that are not mandatory for New(). Default value for HTTPS is false, default port is 9091, default RPC URI is '/transmission/rpc', default HTTPTimeout is 30s.
type BandwidthGroup ¶
type BandwidthGroup struct { HonorSessionLimits bool `json:"honorSessionLimits"` Name string `json:"name"` SpeedLimitDownEnabled bool `json:"speed-limit-down-enabled"` SpeedLimitDown int64 `json:"speed-limit-down"` SpeedLimitUpEnabled bool `json:"speed-limit-up-enabled"` SpeedLimitUp int64 `json:"speed-limit-up"` }
BandwidthGroup represents all possible fields of data for a bandwidth group.
type BandwidthGroupSetPayload ¶
type BandwidthGroupSetPayload struct { HonorSessionLimits *bool `json:"honorSessionLimits"` // true if session upload limits are honored Name *string `json:"name"` // Bandwidth group name SpeedLimitDownEnabled *bool `json:"speed-limit-down-enabled"` // true means enabled SpeedLimitDown *int64 `json:"speed-limit-down"` // max global download speed (KBps) SpeedLimitUpEnabled *bool `json:"speed-limit-up-enabled"` // true means enabled SpeedLimitUp *int64 `json:"speed-limit-up"` // max global upload speed (KBps) }
BandwidthGroupSetPayload contains all the mutators applicable on one bandwidth group.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the base object to interract with a remote transmission rpc endpoint. It must be created with New().
func New ¶
func New(host, user, password string, conf *AdvancedConfig) (c *Client, err error)
New returns an initialized and ready to use Controller
func (*Client) BandwidthGroupGet ¶
func (c *Client) BandwidthGroupGet(ctx context.Context, fields []string, groups []string) (bandwidthGroups []BandwidthGroup, err error)
BandwidthGroupGet returns the given fields for each bandwidth group provided. If no bandwidth group name is provided, returns the given fields for all bandwidth groups.
func (*Client) BandwidthGroupGetAll ¶
func (c *Client) BandwidthGroupGetAll(ctx context.Context) (bandwidthGroups []BandwidthGroup, err error)
BandwidthGroupGetAll returns all the known fields for all bandwidth groups.
func (*Client) BandwidthGroupSet ¶
func (c *Client) BandwidthGroupSet(ctx context.Context, payload BandwidthGroupSetPayload) (err error)
BandwidthGroupSet applies a list of mutator(s) to a bandwidth group.
func (*Client) BlocklistUpdate ¶
BlocklistUpdate triggers a blocklist update. It returns the number of entries of the updated blocklist.
func (*Client) FreeSpace ¶
FreeSpace allow to see how much free space is available in a client-specified folder.
func (*Client) PortTest ¶
PortTest allows tests to see if your incoming peer port is accessible from the outside world.
func (*Client) QueueMoveBottom ¶
QueueMoveBottom moves IDs to the bottom of the queue list.
func (*Client) QueueMoveDown ¶
QueueMoveDown moves IDs of one position down on the queue list.
func (*Client) QueueMoveTop ¶
QueueMoveTop moves IDs to the top of the queue list.
func (*Client) QueueMoveUp ¶
QueueMoveUp moves IDs of one position up on the queue list.
func (*Client) RPCVersion ¶
func (c *Client) RPCVersion(ctx context.Context) (ok bool, serverVersion int64, serverMinimumVersion int64, err error)
RPCVersion returns true if the lib RPC version is greater or equals to the remote server rpc minimum version.
func (*Client) SessionArgumentsGet ¶
func (c *Client) SessionArgumentsGet(ctx context.Context, fields []string) (sessionArgs SessionArguments, err error)
SessionArgumentsGet returns global/session values for specified fields. See the JSON tags of the SessionArguments struct for valid fields. https://github.com/transmission/transmission/blob/4.0.2/docs/rpc-spec.md#412-accessors
func (*Client) SessionArgumentsGetAll ¶
func (c *Client) SessionArgumentsGetAll(ctx context.Context) (sessionArgs SessionArguments, err error)
SessionArgumentsGetAll returns global/session values. https://github.com/transmission/transmission/blob/4.0.2/docs/rpc-spec.md#412-accessors
func (*Client) SessionArgumentsSet ¶
func (c *Client) SessionArgumentsSet(ctx context.Context, payload SessionArguments) (err error)
SessionArgumentsSet allows to modify global/session values. https://github.com/transmission/transmission/blob/4.0.2/docs/rpc-spec.md#411-mutators
func (*Client) SessionClose ¶
SessionClose tells the transmission session to shut down.
func (*Client) SessionStats ¶
func (c *Client) SessionStats(ctx context.Context) (stats SessionStats, err error)
SessionStats returns all (current/cumulative) statistics.
func (*Client) TorrentAdd ¶
func (c *Client) TorrentAdd(ctx context.Context, payload TorrentAddPayload) (torrent Torrent, err error)
TorrentAdd allows to send an Add payload. If successful (torrent added or duplicate) torrent return value will only have HashString, ID and Name fields set up.
func (*Client) TorrentAddFile ¶
TorrentAddFile is wrapper to directly add a torrent file (it handles the base64 encoding and payload generation). If successful (torrent added or duplicate) torrent return value will only have HashString, ID and Name fields set up.
func (*Client) TorrentAddFileDownloadDir ¶
func (c *Client) TorrentAddFileDownloadDir(ctx context.Context, filepath, downloaddir string) (torrent Torrent, err error)
TorrentAddFileDownloadDir is wrapper to directly add a torrent file (it handles the base64 encoding and payload generation) to a DownloadDir (not the default download dir). If successful (torrent added or duplicate) torrent return value will only have HashString, ID and Name fields set up.
func (*Client) TorrentGet ¶
func (c *Client) TorrentGet(ctx context.Context, fields []string, ids []int64) (torrents []Torrent, err error)
TorrentGet returns the given of fields (mandatory) for each ids (optionnal).
func (*Client) TorrentGetAll ¶
TorrentGetAll returns all the known fields for all the torrents.
func (*Client) TorrentGetAllFor ¶
TorrentGetAllFor returns all known fields for the given torrent's ids.
func (*Client) TorrentGetAllForHashes ¶
func (c *Client) TorrentGetAllForHashes(ctx context.Context, hashes []string) (torrents []Torrent, err error)
TorrentGetAllForHashes returns all known fields for the given torrent's ids by string (usually hash).
func (*Client) TorrentGetHashes ¶
func (c *Client) TorrentGetHashes(ctx context.Context, fields []string, hashes []string) (torrents []Torrent, err error)
TorrentGetHashes returns the given of fields (mandatory) for each ids (optionnal).
func (*Client) TorrentReannounceHashes ¶
TorrentReannounceHashes reannounces torrent(s) which hash is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentReannounceIDs ¶
TorrentReannounceIDs reannounces torrent(s) which id is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentReannounceRecentlyActive ¶
TorrentReannounceRecentlyActive reannounces torrent(s) which have been recently active.
func (*Client) TorrentRemove ¶
func (c *Client) TorrentRemove(ctx context.Context, payload TorrentRemovePayload) (err error)
TorrentRemove allows to delete one or more torrents only or with their data.
func (*Client) TorrentRenamePath ¶
TorrentRenamePath allows to rename torrent name or path. 'path' is the path to the file or folder that will be renamed. 'name' the file or folder's new name
func (*Client) TorrentRenamePathHash ¶
TorrentRenamePathHash allows to rename torrent name or path by its hash.
func (*Client) TorrentSet ¶
func (c *Client) TorrentSet(ctx context.Context, payload TorrentSetPayload) (err error)
TorrentSet apply a list of mutator(s) to a list of torrent ids.
func (*Client) TorrentSetLocation ¶
func (c *Client) TorrentSetLocation(ctx context.Context, id int64, location string, move bool) (err error)
TorrentSetLocation allows to set a new location for one or more torrents. 'location' is the new torrent location. 'move' if true, move from previous location. Otherwise, search "location" for file.
func (*Client) TorrentSetLocationHash ¶
func (c *Client) TorrentSetLocationHash(ctx context.Context, hash, location string, move bool) (err error)
TorrentSetLocationHash allows to set a new location for one or more torrents. 'location' is the new torrent location. 'move' if true, move from previous location. Otherwise, search "location" for file.
func (*Client) TorrentStartHashes ¶
TorrentStartHashes starts torrent(s) which hash is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentStartIDs ¶
TorrentStartIDs starts torrent(s) which id is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentStartNowHashes ¶
TorrentStartNowHashes starts (now) torrent(s) which hash is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentStartNowIDs ¶
TorrentStartNowIDs starts (now) torrent(s) which id is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentStartNowRecentlyActive ¶
TorrentStartNowRecentlyActive starts (now) torrent(s) which have been recently active.
func (*Client) TorrentStartRecentlyActive ¶
TorrentStartRecentlyActive starts torrent(s) which have been recently active.
func (*Client) TorrentStopHashes ¶
TorrentStopHashes stops torrent(s) which hash is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentStopIDs ¶
TorrentStopIDs stops torrent(s) which id is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentStopRecentlyActive ¶
TorrentStopRecentlyActive stops torrent(s) which have been recently active.
func (*Client) TorrentVerifyHashes ¶
TorrentVerifyHashes verifys torrent(s) which hash is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
func (*Client) TorrentVerifyIDs ¶
TorrentVerifyIDs verifys torrent(s) which id is in the provided slice. Can be one, can be several, can be all (if slice is empty or nil).
type CumulativeStats ¶
type CumulativeStats struct { DownloadedBytes int64 `json:"downloadedBytes"` FilesAdded int64 `json:"filesAdded"` SecondsActive int64 `json:"secondsActive"` SessionCount int64 `json:"sessionCount"` UploadedBytes int64 `json:"uploadedBytes"` }
CumulativeStats is subset of SessionStats.
func (*CumulativeStats) GetDownloaded ¶
func (cs *CumulativeStats) GetDownloaded() (downloaded cunits.Bits)
GetDownloaded returns cumulative stats downloaded size in a handy format
func (*CumulativeStats) GetUploaded ¶
func (cs *CumulativeStats) GetUploaded() (uploaded cunits.Bits)
GetUploaded returns cumulative stats uploaded size in a handy format
type CurrentStats ¶
type CurrentStats struct { DownloadedBytes int64 `json:"downloadedBytes"` FilesAdded int64 `json:"filesAdded"` SecondsActive int64 `json:"secondsActive"` SessionCount int64 `json:"sessionCount"` UploadedBytes int64 `json:"uploadedBytes"` }
CurrentStats is subset of SessionStats.
func (*CurrentStats) GetDownloaded ¶
func (cs *CurrentStats) GetDownloaded() (downloaded cunits.Bits)
GetDownloaded returns current stats downloaded size in a handy format
func (*CurrentStats) GetUploaded ¶
func (cs *CurrentStats) GetUploaded() (uploaded cunits.Bits)
GetUploaded returns current stats uploaded size in a handy format
type HTTPStatusCode ¶
type HTTPStatusCode int
HTTPStatusCode is a custom error type for HTTP errors
func (HTTPStatusCode) Error ¶
func (hsc HTTPStatusCode) Error() string
type Peer ¶
type Peer struct { Address string `json:"address"` ClientName string `json:"clientName"` ClientIsChoked bool `json:"clientIsChoked"` ClientIsint64erested bool `json:"clientIsint64erested"` FlagStr string `json:"flagStr"` IsDownloadingFrom bool `json:"isDownloadingFrom"` IsEncrypted bool `json:"isEncrypted"` IsIncoming bool `json:"isIncoming"` IsUploadingTo bool `json:"isUploadingTo"` IsUTP bool `json:"isUTP"` PeerIsChoked bool `json:"peerIsChoked"` PeerIsint64erested bool `json:"peerIsint64erested"` Port int64 `json:"port"` Progress float64 `json:"progress"` RateToClient int64 `json:"rateToClient"` // B/s RateToPeer int64 `json:"rateToPeer"` // B/s }
Peer represent a peer metadata of a torrent's peer list.
func (*Peer) ConvertDownloadSpeed ¶
func (p *Peer) ConvertDownloadSpeed() (speed cunits.Bits)
ConvertDownloadSpeed will return the download speed from peer as cunits.Bits/second
func (*Peer) ConvertUploadSpeed ¶
func (p *Peer) ConvertUploadSpeed() (speed cunits.Bits)
ConvertUploadSpeed will return the upload speed to peer as cunits.Bits/second
type SeedRatioMode ¶
type SeedRatioMode int64
SeedRatioMode represents a torrent current seeding mode
const ( // SeedRatioModeGlobal represents the use of the global ratio for a torrent SeedRatioModeGlobal SeedRatioMode = 0 // SeedRatioModeCustom represents the use of a custom ratio for a torrent SeedRatioModeCustom SeedRatioMode = 1 // SeedRatioModeNoRatio represents the absence of ratio for a torrent SeedRatioModeNoRatio SeedRatioMode = 2 )
func (SeedRatioMode) GoString ¶
func (srm SeedRatioMode) GoString() string
GoString implements the GoStringer interface from the stdlib fmt package
func (SeedRatioMode) String ¶
func (srm SeedRatioMode) String() string
type SessionArguments ¶
type SessionArguments struct { AltSpeedDown *int64 `json:"alt-speed-down"` // max global download speed (KBps) AltSpeedEnabled *bool `json:"alt-speed-enabled"` // true means use the alt speeds AltSpeedTimeBegin *int64 `json:"alt-speed-time-begin"` // when to turn on alt speeds (units: minutes after midnight) AltSpeedTimeEnabled *bool `json:"alt-speed-time-enabled"` // true means the scheduled on/off times are used AltSpeedTimeEnd *int64 `json:"alt-speed-time-end"` // when to turn off alt speeds (units: same) AltSpeedTimeDay *int64 `json:"alt-speed-time-day"` // what day(s) to turn on alt speeds (look at tr_sched_day) AltSpeedUp *int64 `json:"alt-speed-up"` // max global upload speed (KBps) BlocklistURL *string `json:"blocklist-url"` // location of the blocklist to use for "blocklist-update" BlocklistEnabled *bool `json:"blocklist-enabled"` // true means enabled BlocklistSize *int64 `json:"blocklist-size"` // number of rules in the blocklist CacheSizeMB *int64 `json:"cache-size-mb"` // maximum size of the disk cache (MB) ConfigDir *string `json:"config-dir"` // location of transmission's configuration directory DefaultTrackers *string `json:"default-trackers"` // list of default trackers to use on public torrents DownloadDir *string `json:"download-dir"` // default path to download torrents DownloadQueueSize *int64 `json:"download-queue-size"` // max number of torrents to download at once (see download-queue-enabled) DownloadQueueEnabled *bool `json:"download-queue-enabled"` // if true, limit how many torrents can be downloaded at once DHTEnabled *bool `json:"dht-enabled"` // true means allow dht in public torrents Encryption *string `json:"encryption"` // "required", "preferred", "tolerated" IdleSeedingLimit *int64 `json:"idle-seeding-limit"` // torrents we're seeding will be stopped if they're idle for this long IdleSeedingLimitEnabled *bool `json:"idle-seeding-limit-enabled"` // true if the seeding inactivity limit is honored by default IncompleteDir *string `json:"incomplete-dir"` // path for incomplete torrents, when enabled IncompleteDirEnabled *bool `json:"incomplete-dir-enabled"` // true means keep torrents in incomplete-dir until done LPDEnabled *bool `json:"lpd-enabled"` // true means allow Local Peer Discovery in public torrents PeerLimitGlobal *int64 `json:"peer-limit-global"` // maximum global number of peers PeerLimitPerTorrent *int64 `json:"peer-limit-per-torrent"` // maximum global number of peers PEXEnabled *bool `json:"pex-enabled"` // true means allow pex in public torrents PeerPort *int64 `json:"peer-port"` // port number PeerPortRandomOnStart *bool `json:"peer-port-random-on-start"` // true means pick a random peer port on launch PortForwardingEnabled *bool `json:"port-forwarding-enabled"` // true means enabled QueueStalledEnabled *bool `json:"queue-stalled-enabled"` // whether or not to consider idle torrents as stalled QueueStalledMinutes *int64 `json:"queue-stalled-minutes"` // torrents that are idle for N minuets aren't counted toward seed-queue-size or download-queue-size RenamePartialFiles *bool `json:"rename-partial-files"` // true means append ".part" to incomplete files RPCVersion *int64 `json:"rpc-version"` // the current RPC API version RPCVersionMinimum *int64 `json:"rpc-version-minimum"` // the minimum RPC API version supported RPCVersionSemVer *string `json:"rpc-version-semver"` // the current RPC API version in a semver-compatible string ScriptTorrentAddedEnabled *bool `json:"script-torrent-added-enabled"` // whether or not to call the added script ScriptTorrentAddedFilename *string `json:"script-torrent-added-filename"` //filename of the script to run ScriptTorrentDoneFilename *string `json:"script-torrent-done-filename"` // filename of the script to run ScriptTorrentDoneEnabled *bool `json:"script-torrent-done-enabled"` // whether or not to call the "done" script ScriptTorrentDoneSeedingEnabled *bool `json:"script-torrent-done-seeding-enabled"` // whether or not to call the seeding-done script ScriptTorrentDoneSeedingFilename *string `json:"script-torrent-done-seeding-filename"` // filename of the script to run SeedRatioLimit *float64 `json:"seedRatioLimit"` // the default seed ratio for torrents to use SeedRatioLimited *bool `json:"seedRatioLimited"` // true if seedRatioLimit is honored by default SeedQueueSize *int64 `json:"seed-queue-size"` // max number of torrents to uploaded at once (see seed-queue-enabled) SeedQueueEnabled *bool `json:"seed-queue-enabled"` // if true, limit how many torrents can be uploaded at once SessionID *string `json:"session-id"` // the current session ID SpeedLimitDown *int64 `json:"speed-limit-down"` // max global download speed (KBps) SpeedLimitDownEnabled *bool `json:"speed-limit-down-enabled"` // true means enabled SpeedLimitUp *int64 `json:"speed-limit-up"` // max global upload speed (KBps) SpeedLimitUpEnabled *bool `json:"speed-limit-up-enabled"` // true means enabled StartAddedTorrents *bool `json:"start-added-torrents"` // true means added torrents will be started right away TrashOriginalTorrentFiles *bool `json:"trash-original-torrent-files"` // true means the .torrent file of added torrents will be deleted Units *Units `json:"units"` // see units below UTPEnabled *bool `json:"utp-enabled"` // true means allow utp Version *string `json:"version"` // long version string "$version ($revision)" }
SessionArguments represents all the global/session values.
func (SessionArguments) MarshalJSON ¶
func (sa SessionArguments) MarshalJSON() (data []byte, err error)
MarshalJSON allows to marshall into JSON only the non nil fields. It differs from 'omitempty' which also skip default values (as 0 or false which can be valid here).
type SessionStats ¶
type SessionStats struct { ActiveTorrentCount int64 `json:"activeTorrentCount"` CumulativeStats CumulativeStats `json:"cumulative-stats"` CurrentStats CurrentStats `json:"current-stats"` DownloadSpeed int64 `json:"downloadSpeed"` PausedTorrentCount int64 `json:"pausedTorrentCount"` TorrentCount int64 `json:"torrentCount"` UploadSpeed int64 `json:"uploadSpeed"` }
SessionStats represents all (current/cumulative) statistics.
type Torrent ¶
type Torrent struct { ActivityDate *time.Time `json:"activityDate"` AddedDate *time.Time `json:"addedDate"` Availability []*int64 `json:"availability"` // RPC v17 BandwidthPriority *int64 `json:"bandwidthPriority"` Comment *string `json:"comment"` CorruptEver *int64 `json:"corruptEver"` Creator *string `json:"creator"` DateCreated *time.Time `json:"dateCreated"` DesiredAvailable *int64 `json:"desiredAvailable"` DoneDate *time.Time `json:"doneDate"` DownloadDir *string `json:"downloadDir"` DownloadedEver *int64 `json:"downloadedEver"` DownloadLimit *int64 `json:"downloadLimit"` DownloadLimited *bool `json:"downloadLimited"` EditDate *time.Time `json:"editDate"` Error *int64 `json:"error"` ErrorString *string `json:"errorString"` Eta *int64 `json:"eta"` EtaIdle *int64 `json:"etaIdle"` FileCount *int64 `json:"file-count"` // RPC v17 Files []*TorrentFile `json:"files"` FileStats []*TorrentFileStat `json:"fileStats"` Group *string `json:"group"` // RPC v17 HashString *string `json:"hashString"` HaveUnchecked *int64 `json:"haveUnchecked"` HaveValid *int64 `json:"haveValid"` HonorsSessionLimits *bool `json:"honorsSessionLimits"` ID *int64 `json:"id"` IsFinished *bool `json:"isFinished"` IsPrivate *bool `json:"isPrivate"` IsStalled *bool `json:"isStalled"` Labels []string `json:"labels"` // RPC v16 LeftUntilDone *int64 `json:"leftUntilDone"` MagnetLink *string `json:"magnetLink"` ManualAnnounceTime *int64 `json:"manualAnnounceTime"` MaxConnectedPeers *int64 `json:"maxConnectedPeers"` MetadataPercentComplete *float64 `json:"metadataPercentComplete"` Name *string `json:"name"` PeerLimit *int64 `json:"peer-limit"` Peers []*Peer `json:"peers"` PeersConnected *int64 `json:"peersConnected"` PeersFrom *TorrentPeersFrom `json:"peersFrom"` PeersGettingFromUs *int64 `json:"peersGettingFromUs"` PeersSendingToUs *int64 `json:"peersSendingToUs"` PercentComplete *float64 `json:"percentComplete"` // RPC v17 PercentDone *float64 `json:"percentDone"` Pieces *string `json:"pieces"` PieceCount *int64 `json:"pieceCount"` PieceSize *cunits.Bits `json:"pieceSize"` Priorities []int64 `json:"priorities"` PrimaryMimeType *string `json:"primary-mime-type"` // RPC v17 QueuePosition *int64 `json:"queuePosition"` RateDownload *int64 `json:"rateDownload"` // B/s RateUpload *int64 `json:"rateUpload"` // B/s RecheckProgress *float64 `json:"recheckProgress"` SecondsDownloading *int64 `json:"secondsDownloading"` SecondsSeeding *time.Duration `json:"secondsSeeding"` SeedIdleLimit *int64 `json:"seedIdleLimit"` SeedIdleMode *int64 `json:"seedIdleMode"` SeedRatioLimit *float64 `json:"seedRatioLimit"` SeedRatioMode *SeedRatioMode `json:"seedRatioMode"` SizeWhenDone *cunits.Bits `json:"sizeWhenDone"` StartDate *time.Time `json:"startDate"` Status *TorrentStatus `json:"status"` Trackers []*Tracker `json:"trackers"` TrackerList *string `json:"trackerList"` TrackerStats []*TrackerStats `json:"trackerStats"` TotalSize *cunits.Bits `json:"totalSize"` TorrentFile *string `json:"torrentFile"` UploadedEver *int64 `json:"uploadedEver"` UploadLimit *int64 `json:"uploadLimit"` UploadLimited *bool `json:"uploadLimited"` UploadRatio *float64 `json:"uploadRatio"` Wanted []bool `json:"wanted"` WebSeeds []string `json:"webseeds"` WebSeedsSendingToUs *int64 `json:"webseedsSendingToUs"` }
Torrent represents all the possible fields of data for a torrent. All fields are pointers to detect if the value is nil (field not requested) or default real default value.
func (*Torrent) ConvertDownloadSpeed ¶
func (t *Torrent) ConvertDownloadSpeed() (speed cunits.Bits)
ConvertDownloadSpeed will return the download speed as cunits.Bitss/second
func (*Torrent) ConvertUploadSpeed ¶
func (t *Torrent) ConvertUploadSpeed() (speed cunits.Bits)
ConvertUploadSpeed will return the upload speed as cunits.Bitss/second
func (Torrent) MarshalJSON ¶
MarshalJSON allows to convert back golang values to original payload values.
func (*Torrent) UnmarshalJSON ¶
UnmarshalJSON allows to convert timestamps to golang time.Time values.
type TorrentAddPayload ¶
type TorrentAddPayload struct { Cookies *string `json:"cookies"` // pointer to a string of one or more cookies DownloadDir *string `json:"download-dir"` // path to download the torrent to Filename *string `json:"filename"` // filename or URL of the .torrent file Labels []string `json:"labels"` // Labels for the torrent MetaInfo *string `json:"metainfo"` // base64-encoded .torrent content Paused *bool `json:"paused"` // if true, don't start the torrent PeerLimit *int64 `json:"peer-limit"` // maximum number of peers BandwidthPriority *int64 `json:"bandwidthPriority"` // torrent's bandwidth tr_priority_t FilesWanted []int64 `json:"files-wanted"` // indices of file(s) to download FilesUnwanted []int64 `json:"files-unwanted"` // indices of file(s) to not download PriorityHigh []int64 `json:"priority-high"` // indices of high-priority file(s) PriorityLow []int64 `json:"priority-low"` // indices of low-priority file(s) PriorityNormal []int64 `json:"priority-normal"` // indices of normal-priority file(s) }
TorrentAddPayload represents the data to send in order to add a torrent.
func (TorrentAddPayload) MarshalJSON ¶
func (tap TorrentAddPayload) MarshalJSON() (data []byte, err error)
MarshalJSON allows to marshall into JSON only the non nil fields. It differs from 'omitempty' which also skip default values (as 0 or false which can be valid here).
type TorrentFile ¶
type TorrentFile struct { BytesCompleted int64 `json:"bytesCompleted"` Length int64 `json:"length"` Name string `json:"name"` }
TorrentFile represent one file from a Torrent.
type TorrentFileStat ¶
type TorrentFileStat struct { BytesCompleted int64 `json:"bytesCompleted"` Wanted bool `json:"wanted"` Priority int64 `json:"priority"` }
TorrentFileStat represents the metadata of a torrent's file.
type TorrentPeersFrom ¶
type TorrentPeersFrom struct { FromCache int64 `json:"fromCache"` FromDHT int64 `json:"fromDht"` FromIncoming int64 `json:"fromIncoming"` FromLPD int64 `json:"fromLpd"` FromLTEP int64 `json:"fromLtep"` FromPEX int64 `json:"fromPex"` FromTracker int64 `json:"fromTracker"` }
TorrentPeersFrom represents the peers statistics of a torrent.
type TorrentRemovePayload ¶
type TorrentRemovePayload struct { IDs []int64 `json:"ids"` DeleteLocalData bool `json:"delete-local-data"` }
TorrentRemovePayload holds the torrent id(s) to delete with a data deletion flag.
type TorrentSetPayload ¶
type TorrentSetPayload struct { BandwidthPriority *int64 `json:"bandwidthPriority"` // this torrent's bandwidth tr_priority_t DownloadLimit *int64 `json:"downloadLimit"` // maximum download speed (KBps) DownloadLimited *bool `json:"downloadLimited"` // true if "downloadLimit" is honored FilesWanted []int64 `json:"files-wanted"` // indices of file(s) to download FilesUnwanted []int64 `json:"files-unwanted"` // indices of file(s) to not download Group *string `json:"group"` // bandwidth group to add torrent to HonorsSessionLimits *bool `json:"honorsSessionLimits"` // true if session upload limits are honored IDs []int64 `json:"ids"` // torrent list Labels []string `json:"labels"` // RPC v16: strings of user-defined labels Location *string `json:"location"` // new location of the torrent's content PeerLimit *int64 `json:"peer-limit"` // maximum number of peers PriorityHigh []int64 `json:"priority-high"` // indices of high-priority file(s) PriorityLow []int64 `json:"priority-low"` // indices of low-priority file(s) PriorityNormal []int64 `json:"priority-normal"` // indices of normal-priority file(s) QueuePosition *int64 `json:"queuePosition"` // position of this torrent in its queue [0...n) SeedIdleLimit *time.Duration `json:"seedIdleLimit"` // torrent-level number of minutes of seeding inactivity SeedIdleMode *int64 `json:"seedIdleMode"` // which seeding inactivity to use SeedRatioLimit *float64 `json:"seedRatioLimit"` // torrent-level seeding ratio SeedRatioMode *SeedRatioMode `json:"seedRatioMode"` // which ratio mode to use TrackerList *string `json:"trackerList"` // string of announce URLs, one per line, and a blank line between tiers UploadLimit *int64 `json:"uploadLimit"` // maximum upload speed (KBps) UploadLimited *bool `json:"uploadLimited"` // true if "uploadLimit" is honored }
TorrentSetPayload contains all the mutators appliable on one torrent.
func (TorrentSetPayload) MarshalJSON ¶
func (tsp TorrentSetPayload) MarshalJSON() (data []byte, err error)
MarshalJSON allows to marshall into JSON only the non nil fields. It differs from 'omitempty' which also skip default values (as 0 or false which can be valid here).
type TorrentStatus ¶
type TorrentStatus int64
TorrentStatus binds torrent status to a status code
const ( // TorrentStatusStopped represents a stopped torrent TorrentStatusStopped TorrentStatus = 0 // TorrentStatusCheckWait represents a torrent queued for files checking TorrentStatusCheckWait TorrentStatus = 1 // TorrentStatusCheck represents a torrent which files are currently checked TorrentStatusCheck TorrentStatus = 2 // TorrentStatusDownloadWait represents a torrent queue to download TorrentStatusDownloadWait TorrentStatus = 3 // TorrentStatusDownload represents a torrent currently downloading TorrentStatusDownload TorrentStatus = 4 // TorrentStatusSeedWait represents a torrent queued to seed TorrentStatusSeedWait TorrentStatus = 5 // TorrentStatusSeed represents a torrent currently seeding TorrentStatusSeed TorrentStatus = 6 // TorrentStatusIsolated represents a torrent which can't find peers TorrentStatusIsolated TorrentStatus = 7 )
func (TorrentStatus) GoString ¶
func (status TorrentStatus) GoString() string
GoString implements the GoStringer interface from the stdlib fmt package
func (TorrentStatus) String ¶
func (status TorrentStatus) String() string
type Tracker ¶
type Tracker struct { Announce string `json:"announce"` ID int64 `json:"id"` Scrape string `json:"scrape"` SiteName string `json:"sitename"` Tier int64 `json:"tier"` }
Tracker represent the base data of a torrent's tracker.
type TrackerStats ¶
type TrackerStats struct { Announce string `json:"announce"` AnnounceState int64 `json:"announceState"` DownloadCount int64 `json:"downloadCount"` HasAnnounced bool `json:"hasAnnounced"` HasScraped bool `json:"hasScraped"` Host string `json:"host"` ID int64 `json:"id"` IsBackup bool `json:"isBackup"` LastAnnouncePeerCount int64 `json:"lastAnnouncePeerCount"` LastAnnounceResult string `json:"lastAnnounceResult"` LastAnnounceStartTime time.Time `json:"lastAnnounceStartTime"` LastAnnounceSucceeded bool `json:"lastAnnounceSucceeded"` LastAnnounceTime time.Time `json:"lastAnnounceTime"` LastAnnounceTimedOut bool `json:"lastAnnounceTimedOut"` LastScrapeResult string `json:"lastScrapeResult"` LastScrapeStartTime time.Time `json:"lastScrapeStartTime"` LastScrapeSucceeded bool `json:"lastScrapeSucceeded"` LastScrapeTime time.Time `json:"lastScrapeTime"` LastScrapeTimedOut bool `json:"lastScrapeTimedOut"` // should be boolean but number. Will be converter in UnmarshalJSON LeecherCount int64 `json:"leecherCount"` NextAnnounceTime time.Time `json:"nextAnnounceTime"` NextScrapeTime time.Time `json:"nextScrapeTime"` Scrape string `json:"scrape"` ScrapeState int64 `json:"scrapeState"` SiteName string `json:"sitename"` SeederCount int64 `json:"seederCount"` Tier int64 `json:"tier"` }
TrackerStats represent the extended data of a torrent's tracker.
func (TrackerStats) MarshalJSON ¶
func (ts TrackerStats) MarshalJSON() (data []byte, err error)
MarshalJSON allows to convert back golang values to original payload values.
func (*TrackerStats) UnmarshalJSON ¶
func (ts *TrackerStats) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON allows to convert timestamps to golang time.Time values.
type TransmissionFreeSpace ¶
type TransmissionFreeSpace struct { Path string `json:"path"` Size int64 `json:"size-bytes"` TotalSize int64 `json:"total_size"` // RPC v17 }
TransmissionFreeSpace represents the freespace available in bytes for a specific path.
type Units ¶
type Units struct { SpeedUnits []string `json:"speed-units"` // 4 strings: KB/s, MB/s, GB/s, TB/s SpeedBytes int64 `json:"speed-bytes"` // number of bytes in a KB (1000 for kB; 1024 for KiB) SizeUnits []string `json:"size-units"` // 4 strings: KB/s, MB/s, GB/s, TB/s SizeBytes int64 `json:"size-bytes"` // number of bytes in a KB (1000 for kB; 1024 for KiB) MemoryUnits []string `json:"memory-units"` // 4 strings: KB/s, MB/s, GB/s, TB/s MemoryBytes int64 `json:"memory-bytes"` // number of bytes in a KB (1000 for kB; 1024 for KiB) }
Units is subset of SessionArguments.
func (*Units) GetMemory ¶
func (u *Units) GetMemory() (memory cunits.Bits)
GetMemory returns the memory in a handy format
Source Files ¶
- bandwidth_group_accessors.go
- bandwidth_group_mutators.go
- blocklist.go
- controller.go
- free_space.go
- port_checking.go
- queue_movement.go
- request.go
- session_arguments.go
- session_shutdown.go
- session_stats.go
- torrent_accessors.go
- torrent_action_requests.go
- torrent_add.go
- torrent_mutators.go
- torrent_remove.go
- torrent_rename_path.go
- torrent_set_location.go