Documentation ¶
Index ¶
- func ConstructAddress(secure bool, host string, port int) string
- func UniqueStrings(ss []string) []string
- type Accessor_Argument
- type Action_Argument
- type Add_Argument
- type Add_Response
- type Arguments
- type Client
- func (self *Client) AddTorrent(location string, path string) (*Torrent, error)
- func (self *Client) Exists(magnet string) bool
- func (self *Client) GetClientAddress() string
- func (self *Client) GetClientHTTPClient() *http.Client
- func (self *Client) GetClientLastSeen() int64
- func (self *Client) GetClientPassword() string
- func (self *Client) GetClientSession() string
- func (self *Client) GetClientUsername() string
- func (self *Client) GetSession() (*Session_Arguments, error)
- func (self *Client) GetStats() (*Session_Stats_Response, error)
- func (self *Client) GetTorrents() ([]*Torrent, error)
- func (self *Client) IDs(magnets ...string) ([]int, []string, error)
- func (self *Client) IDsNot(ignore_magnets ...string) ([]int, []string, error)
- func (self *Client) ReannounceTorrents(magnets ...string) ([]string, error)
- func (self *Client) ReannounceUnknownTorrents(ignore_magnets ...string) ([]string, error)
- func (self *Client) RemoveTorrents(magnets ...string) ([]string, error)
- func (self *Client) RemoveUnknownTorrents(ignore_magnets ...string) ([]string, error)
- func (self *Client) Request(req *Request) (*Response, error)
- func (self *Client) StartNowTorrents(magnets ...string) ([]string, error)
- func (self *Client) StartNowUnknownTorrents(ignore_magnets ...string) ([]string, error)
- func (self *Client) StartTorrents(magnets ...string) ([]string, error)
- func (self *Client) StartUnknownTorrents(ignore_magnets ...string) ([]string, error)
- func (self *Client) StopTorrents(magnets ...string) ([]string, error)
- func (self *Client) StopUnknownTorrents(ignore_magnets ...string) ([]string, error)
- func (self *Client) VerifyTorrents(magnets ...string) ([]string, error)
- func (self *Client) VerifyUnknownTorrents(ignore_magnets ...string) ([]string, error)
- type File
- type FileStat
- type Move_Argument
- type Mutator_Argument
- type Peer
- type PeersFrom
- type Remove_Argument
- type Rename_Argument
- type Request
- type Response
- type Session_Arguments
- type Session_Stats_Response
- type Session_Stats_Units
- type Session_Units
- type Torrent
- type Torrent_Response
- type Tracker
- type TrackerStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UniqueStrings ¶
Types ¶
type Accessor_Argument ¶
type Accessor_Argument struct { IDs []int `json:"ids,omitempty"` Fields []string `json:"fields,omitempty"` }
Method name
torrent-get
All torrents are used if the "ids" argument is omitted.
type Action_Argument ¶
type Action_Argument struct {
IDs []int `json:"ids,omitempty"`
}
Method name
torrent-start torrent-start-now torrent-stop torrent-verify torrent-reannounce
All torrents are used if the "ids" argument is omitted.
type Add_Argument ¶
type Add_Argument struct { Cookies string `json:"cookies,omitempty"` DownloadDir string `json:"download-dir,omitempty"` Filename string `json:"filename,omitempty"` MetaInfo string `json:"metainfo,omitempty"` Paused bool `json:"paused,omitempty"` PeerLimit int `json:"peer-limit,omitempty"` BandwidthPriority int `json:"bandwidthPriority,omitempty"` FilesWanted []*File `json:"files-wanted,omitempty"` FilesUnwanted []*File `json:"files-unwanted,omitempty"` PriorityHigh []*File `json:"priority-high,omitempty"` PriorityLow []*File `json:"priority-low,omitempty"` PriorityNormal []*File `json:"priority-normal,omitempty"` }
Method name
torrent-add
Either "filename" OR "metainfo" MUST be included.
Response arguments:
On success, a "torrent-added" object contains id, name, and hashString.
On failure due to a duplicate torrent existing, a "torrent-duplicate" object in the same form.
type Add_Response ¶
type Add_Response struct {
Torrent *Torrent `json:"torrent-added,omitempty"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddTorrent ¶
func (*Client) GetClientAddress ¶
func (*Client) GetClientHTTPClient ¶
func (*Client) GetClientLastSeen ¶
func (*Client) GetClientPassword ¶
func (*Client) GetClientSession ¶
func (*Client) GetClientUsername ¶
func (*Client) GetSession ¶
func (self *Client) GetSession() ( *Session_Arguments, error, )
func (*Client) GetStats ¶
func (self *Client) GetStats() ( *Session_Stats_Response, error, )
func (*Client) GetTorrents ¶
func (*Client) ReannounceTorrents ¶
func (*Client) ReannounceUnknownTorrents ¶
func (*Client) RemoveTorrents ¶
func (*Client) RemoveUnknownTorrents ¶
func (*Client) StartNowTorrents ¶
func (*Client) StartNowUnknownTorrents ¶
func (*Client) StartTorrents ¶
func (*Client) StartUnknownTorrents ¶
func (*Client) StopTorrents ¶
func (*Client) StopUnknownTorrents ¶
func (*Client) VerifyTorrents ¶
type Move_Argument ¶
type Move_Argument struct { IDs []int `json:"ids,omitempty"` Location string `json:"location,omitempty"` Move bool `json:"move,omitempty"` }
Method name
torrent-set-location
All torrents are used if the "ids" argument is omitted.
type Mutator_Argument ¶
type Mutator_Argument struct { IDs []int `json:"ids,omitempty"` BandwidthPriority int `json:"bandwidthPriority,omitempty"` DownloadLimit int `json:"downloadLimit,omitempty"` DownloadLimited bool `json:"downloadLimited,omitempty"` FilesWanted []*File `json:"files-wanted,omitempty"` FilesUnwanted []*File `json:"files-unwanted,omitempty"` HonorsSessionLimits bool `json:"honorsSessionLimits,omitempty"` Location string `json:"location,omitempty"` PeerLimit int `json:"peer-limit,omitempty"` PriorityHigh []*File `json:"priority-high,omitempty"` PriorityLow []*File `json:"priority-low,omitempty"` PriorityNormal []*File `json:"priority-normal,omitempty"` QueuePosition int `json:"queuePosition,omitempty"` SeedIdleLimit int `json:"seedIdleLimit,omitempty"` SeedIdleMode int `json:"seedIdleMode,omitempty"` SeedRatioLimit float64 `json:"seedRatioLimit,omitempty"` SeedRatioMode int `json:"seedRatioMode,omitempty"` TrackerAdd []string `json:"trackerAdd,omitempty"` TrackerRemove []int `json:"trackerRemove,omitempty"` TrackerReplace []string `json:"trackerReplace,omitempty"` UploadLimit int `json:"uploadLimit,omitempty"` UploadLimited bool `json:"uploadLimited,omitempty"` }
Method name
torrent-set
Just as an empty "ids" value is shorthand for "all ids", using an empty array for "files-wanted", "files-unwanted", "priority-high", "priority-low", or "priority-normal" is shorthand for saying "all files".
type Peer ¶
type Peer struct { Address string `json:"address,omitempty"` ClientName string `json:"clientName,omitempty"` ClientIsChoked bool `json:"clientIsChoked,omitempty"` ClientIsInterested bool `json:"clientIsInterested,omitempty"` FlagStr string `json:"flagStr,omitempty"` IsDownloadingFrom bool `json:"isDownloadingFrom,omitempty"` IsEncrypted bool `json:"isEncrypted,omitempty"` IsIncoming bool `json:"isIncoming,omitempty"` IsUploadingTo bool `json:"isUploadingTo,omitempty"` IsUTP bool `json:"isUTP,omitempty"` PeerIsChoked bool `json:"peerIsChoked,omitempty"` PeerIsInterested bool `json:"peerIsInterested,omitempty"` Port int `json:"port,omitempty"` Progress float64 `json:"progress,omitempty"` RateToClient int `json:"rateToClient,omitempty"` RateToPeer int `json:"rateToPeer,omitempty"` }
type PeersFrom ¶
type PeersFrom struct { FromCache int `json:"fromCache,omitempty"` FromDHT int `json:"fromDht,omitempty"` FromIncoming int `json:"fromIncoming,omitempty"` FromLPD int `json:"fromLpd,omitempty"` FromLTEP int `json:"fromLtep,omitempty"` FromPEX int `json:"fromPex,omitempty"` FromTracker int `json:"fromTracker,omitempty"` }
type Remove_Argument ¶
type Remove_Argument struct { IDs []int `json:"ids,omitempty"` DeleteLocalData bool `json:"delete-local-data,omitempty"` }
Method name
torrent-remove
All torrents are used if the "ids" argument is omitted.
type Rename_Argument ¶
type Rename_Argument struct { IDs []int `json:"ids,omitempty"` Path string `json:"path,omitempty"` Name bool `json:"name,omitempty"` }
Method name
torrent-rename-path
All torrents are used if the "ids" argument is omitted.
if this call succeeds you'll want to update the torrent's "files" and "name" field with torrent-get.
type Request ¶
type Request struct { Method string `json:"method,omitempty"` Args interface{} `json:"arguments,omitempty"` }
Requests support three keys:
(1) A required "method" string telling the name of the method to invoke (2) An optional "arguments" object of key/value pairs (3) An optional "tag" number used by clients to track responses. If provided by a request, the response MUST include the same tag.
type Response ¶
type Response struct { Args json.RawMessage `json:"arguments,omitempty"` Result string `json:"result,omitempty"` }
Reponses support three keys:
(1) A required "result" string whose value MUST be "success" on success, or an error string on failure. (2) An optional "arguments" object of key/value pairs (3) An optional "tag" number as described in 2.1.
type Session_Arguments ¶
type Session_Arguments struct { AltSpeedDown int `json:"alt-speed-down,omitempty"` AltSpeedEnabled bool `json:"alt-speed-enabled,omitempty"` AltSpeedTimeBegin int `json:"alt-speed-time-begin,omitempty"` AltSpeedTimeEnabled bool `json:"alt-speed-time-enabled,omitempty"` AltSpeedTimeEnd int `json:"alt-speed-time-end,omitempty"` AltSpeedTimeDay int `json:"alt-speed-time-day,omitempty"` AltSpeedUp int `json:"alt-speed-up,omitempty"` BlocklistUrl string `json:"blocklist-url,omitempty"` BlocklistEnabled bool `json:"blocklist-enabled,omitempty"` BlocklistSize int `json:"blocklist-size,omitempty"` CacheSizeMB int `json:"cache-size-mb,omitempty"` ConfigDir string `json:"config-dir,omitempty"` DownloadDir string `json:"download-dir,omitempty"` DownloadQueueSize int `json:"download-queue-size,omitempty"` DownloadQueueEnabled bool `json:"download-queue-enabled,omitempty"` DHTEnabled bool `json:"dht-enabled,omitempty"` Encryption string `json:"encryption,omitempty"` IdleSeedingLimit int `json:"idle-seeding-limit,omitempty"` IdleSeedingLimitEnabled bool `json:"idle-seeding-limit-enabled,omitempty"` IncompleteDir string `json:"incomplete-dir,omitempty"` IncompleteDirEnabled bool `json:"incomplete-dir-enabled,omitempty"` LPDEnabled bool `json:"lpd-enabled,omitempty"` PeerLimitGlobal int `json:"peer-limit-global,omitempty"` PeerLimitPerTorrent int `json:"peer-limit-per-torrent,omitempty"` PEXEnabled bool `json:"pex-enabled,omitempty"` PeerPort int `json:"peer-port,omitempty"` PeerPortRandomOnStart bool `json:"peer-port-random-on-start,omitempty"` PortForwardingEnabled bool `json:"port-forwarding-enabled,omitempty"` QueueStalledEnabled bool `json:"queue-stalled-enabled,omitempty"` QueueStalledMinutes int `json:"queue-stalled-minutes,omitempty"` RenamePartialFiles bool `json:"rename-partial-files,omitempty"` RPCVersion int `json:"rpc-version,omitempty"` RPCVersionMinimum int `json:"rpc-version-minimum,omitempty"` ScriptTorrentDoneFilename string `json:"script-torrent-done-filename,omitempty"` ScriptTorrentDoneEnabled bool `json:"script-torrent-done-enabled,omitempty"` SeedRatioLimit float64 `json:"seedRatioLimit,omitempty"` SeedRatioLimited bool `json:"seedRatioLimited,omitempty"` SeedQueueSize int `json:"seed-queue-size,omitempty"` SeedQueueEnabled bool `json:"seed-queue-enabled,omitempty"` SpeedLimitDown int `json:"speed-limit-down,omitempty"` SpeedLimitDownEnabled bool `json:"speed-limit-down-enabled,omitempty"` SpeedLimitUp int `json:"speed-limit-up,omitempty"` SpeedLimitUpEnabled bool `json:"speed-limit-up-enabled,omitempty"` StartAddedTorrents bool `json:"start-added-torrents,omitempty"` TrashOriginalTorrentFiles bool `json:"trash-original-torrent-files,omitempty"` Units *Session_Units `json:"units,omitempty"` UTPEnabled bool `json:"utp-enabled,omitempty"` Version string `json:"version,omitempty"` }
Method name
session-get session-set
session-set: any attribute except:
"config-dir", "rpc-version", "rpc-version-minimum", "version",
type Session_Stats_Response ¶
type Session_Stats_Response struct { ActiveTorrentCount int `json:"activeTorrentCount,omitempty"` DownloadSpeed int `json:"downloadSpeed,omitempty"` PausedTorrentCount int `json:"pausedTorrentCount,omitempty"` TorrentCount int `json:"torrentCount,omitempty"` UploadSpeed int `json:"uploadSpeed,omitempty"` CumulativeStats *Session_Stats_Units `json:"cumulative-stats,omitempty"` CurrentStats *Session_Stats_Units `json:"current-stats,omitempty"` }
Method name
session-stats
type Session_Stats_Units ¶
type Session_Units ¶
type Session_Units struct { SpeedUnits []string `json:"speed-units,omitempty"` SpeedBytes int `json:"speed-bytes,omitempty"` SizeUnits []string `json:"size-units,omitempty"` SizeBytes int `json:"size-bytes,omitempty"` MemoryUnits []string `json:"memory-units,omitempty"` MemoryBytes int `json:"memory-bytes,omitempty"` }
type Torrent ¶
type Torrent struct { ID int `json:"id,omitempty"` ActivityDate int `json:"activityDate,omitempty"` AddedDate int `json:"addedDate,omitempty"` BandwidthPriority int `json:"bandwidthPriority,omitempty"` Comment string `json:"comment,omitempty"` CorruptEver int `json:"corruptEver,omitempty"` Creator string `json:"creator,omitempty"` DateCreated int `json:"dateCreated,omitempty"` DesiredAvailable int `json:"desiredAvailable,omitempty"` DoneDate int `json:"doneDate,omitempty"` DownloadDir string `json:"downloadDir,omitempty"` DownloadedEver int `json:"downloadedEver,omitempty"` DownloadLimit int `json:"downloadLimit,omitempty"` DownloadLimited bool `json:"downloadLimited,omitempty"` Error int `json:"error,omitempty"` ErrorString string `json:"errorString,omitempty"` Eta int `json:"eta,omitempty"` EtaIdle int `json:"etaIdle,omitempty"` Files []*File `json:"files,omitempty"` FileStats []*FileStat `json:"fileStats,omitempty"` HashString string `json:"hashString,omitempty"` HaveUnchecked int `json:"haveUnchecked,omitempty"` HaveValid int `json:"haveValid,omitempty"` HonorsSessionLimits bool `json:"honorsSessionLimits,omitempty"` IsFinished bool `json:"isFinished,omitempty"` IsPrivate bool `json:"isPrivate,omitempty"` IsStalled bool `json:"isStalled,omitempty"` LeftUntilDone int `json:"leftUntilDone,omitempty"` MagnetLink string `json:"magnetLink,omitempty"` ManualAnnounceTime int `json:"manualAnnounceTime,omitempty"` MaxConnectedPeers int `json:"maxConnectedPeers,omitempty"` MetadataPercentComplete float64 `json:"metadataPercentComplete,omitempty"` Name string `json:"name,omitempty"` PeerLimit int `json:"peer-limit,omitempty"` Peers []*Peer `json:"peers,omitempty"` PeersConnected int `json:"peersConnected,omitempty"` PeersFrom *PeersFrom `json:"peersFrom,omitempty"` PeersGettingFromUs int `json:"peersGettingFromUs,omitempty"` PeersSendingToUs int `json:"peersSendingToUs,omitempty"` PercentDone float64 `json:"percentDone,omitempty"` Pieces string `json:"pieces,omitempty"` PieceCount int `json:"pieceCount,omitempty"` PieceSize int `json:"pieceSize,omitempty"` Priorities []int `json:"priorities,omitempty"` QueuePosition int `json:"queuePosition,omitempty"` RateDownload int `json:"rateDownload,omitempty"` RateUpload int `json:"rateUpload,omitempty"` RecheckProgress float64 `json:"recheckProgress,omitempty"` SecondsDownloading int `json:"secondsDownloading,omitempty"` SecondsSeeding int `json:"secondsSeeding,omitempty"` SeedIdleLimit int `json:"seedIdleLimit,omitempty"` SeedIdleMode int `json:"seedIdleMode,omitempty"` SeedRatioLimit float64 `json:"seedRatioLimit,omitempty"` SeedRatioMode int `json:"seedRatioMode,omitempty"` SizeWhenDone int `json:"sizeWhenDone,omitempty"` StartDate int `json:"startDate,omitempty"` Status int `json:"status,omitempty"` Trackers []*Tracker `json:"trackers,omitempty"` TrackerStats []*TrackerStat `json:"trackerStats,omitempty"` TotalSize int `json:"totalSize,omitempty"` TorrentFile string `json:"torrentFile,omitempty"` UploadedEver int `json:"uploadedEver,omitempty"` UploadLimit int `json:"uploadLimit,omitempty"` UploadLimited bool `json:"uploadLimited,omitempty"` UploadRatio float64 `json:"uploadRatio,omitempty"` Wanted []int `json:"wanted,omitempty"` Webseeds []string `json:"webseeds,omitempty"` WebseedsSendingToUs int `json:"webseedsSendingToUs,omitempty"` }
type Torrent_Response ¶
type Torrent_Response struct {
Torrents []*Torrent `json:"torrents,omitempty"`
}
type TrackerStat ¶
type TrackerStat struct { ID int `json:"id,omitempty"` Announce string `json:"announce,omitempty"` AnnounceState int `json:"announceState,omitempty"` DownloadCount int `json:"downloadCount,omitempty"` HasAnnounced bool `json:"hasAnnounced,omitempty"` HasScraped bool `json:"hasScraped,omitempty"` Host string `json:"host,omitempty"` IsBackup bool `json:"isBackup,omitempty"` LastAnnouncePeerCount int `json:"lastAnnouncePeerCount,omitempty"` LastAnnounceResult string `json:"lastAnnounceResult,omitempty"` LastAnnounceStartTime int `json:"lastAnnounceStartTime,omitempty"` LastAnnounceSucceeded bool `json:"lastAnnounceSucceeded,omitempty"` LastAnnounceTime int `json:"lastAnnounceTime,omitempty"` LastAnnounceTimedOut bool `json:"lastAnnounceTimedOut,omitempty"` LastScrapeResult string `json:"lastScrapeResult,omitempty"` LastScrapeStartTime int `json:"lastScrapeStartTime,omitempty"` LastScrapeSucceeded bool `json:"lastScrapeSucceeded,omitempty"` LastScrapeTime int `json:"lastScrapeTime,omitempty"` LastScrapeTimedOut int `json:"lastScrapeTimedOut,omitempty"` LeecherCount int `json:"leecherCount,omitempty"` NextAnnounceTime int `json:"nextAnnounceTime,omitempty"` NextScrapeTime int `json:"nextScrapeTime,omitempty"` Scrape string `json:"scrape,omitempty"` ScrapeState int `json:"scrapeState,omitempty"` SeederCount int `json:"seederCount,omitempty"` Tier int `json:"tier,omitempty"` }