transmission

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 15 Imported by: 8

Documentation

Overview

Package transmission implement Go client for Transmission torrent client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptBool

func OptBool(v bool) *bool

OptBool is a helper routine that allocates new bool to store v and return a pointer to it.

func OptDuration

func OptDuration(v time.Duration) *time.Duration

OptDuration is a helper routine that allocates new time.Duration to store v and return a pointer to it.

func OptFloat64

func OptFloat64(v float64) *float64

OptFloat64 is a helper routine that allocates new float64 to store v and returns a pointer to it.

func OptInt

func OptInt(v int) *int

OptInt is a helper routine that allocates new int to store v and returns a pointer to it.

func OptInt64

func OptInt64(v int64) *int64

OptInt64 is a helper routine that allocates new int64 to store v and returns a pointer to it.

func OptString

func OptString(v string) *string

OptString is a helper routine that allocates new string to store v and returns a pointer to it.

Types

type AddTorrentReq

type AddTorrentReq struct {
	// Either a path/URL to torrent or magnet link
	URL *string `json:"filename,omitempty"`
	// Contents of the torrent file
	Meta io.Reader `json:"-"`
	// Custom download directory for the torrent
	DownloadDirectory *string `json:"download-dir,omitempty"`
	// Cookies to attach to HTTP request when downloading torrent file over
	// the network
	Cookies []Cookie `json:"-"`

	// Don't automatically start torrent
	Paused *bool `json:"paused,omitempty"`
	// Labels to attach to the torrent to
	Labels []string `json:"labels,omitempty"`

	// Bandwidth priority
	Priority *Priority `json:"bandwidthPriority,omitempty"`
	// List of high priority file indicies
	HighPriorityFiles []int `json:"priority-high,omitempty"`
	// List of normal priority file indicies
	NormalPriorityFiles []int `json:"priority-normal,omitempty"`
	// List of low priority file indicies
	LowPriorityFiles []int `json:"priority-low,omitempty"`

	// Custom peer limit
	PeerLimit *int `json:"peer-limit,omitempty"`

	// List of file indicies to download
	WantedFiles []int `json:"files-wanted,omitempty"`
	// List of files indicies to not download
	UnwatedFiles []int `json:"files-unwanted,omitempty"`
}

AddTorrentReq holds information needed to add new torrent to transission. Either URL or Meta must be set.

type Client

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

Client is a Transmission RPC client.

func New

func New(host string, opts ...Option) (*Client, error)

New returns new instance of a Client.

func (*Client) AddTorrent

func (c *Client) AddTorrent(ctx context.Context, req *AddTorrentReq) (*NewTorrent, error)

AddTorrent adds new torrent to Transmission.

func (*Client) GetFreeSpace

func (c *Client) GetFreeSpace(ctx context.Context, path string) (int64, error)

GetFreeSpace returns how much space in bytes is available in the specified folder.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L618

func (*Client) GetRecentlyRemovedTorrentIDs

func (c *Client) GetRecentlyRemovedTorrentIDs(ctx context.Context) ([]ID, error)

GetRecentlyRemovedTorrentIDs returns a slice of torrent IDs that's been removed in the past hour.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, fields ...SessionField) (*Session, error)

GetSession returns detailed information about current Transmission session.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L540

func (*Client) GetSessionStats

func (c *Client) GetSessionStats(ctx context.Context) (*SessionStats, error)

GetSessionStats returns statistics about current session and cumulative statistics about all sessions.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L546

func (*Client) GetTorrents

func (c *Client) GetTorrents(ctx context.Context, ids Identifier, fields ...TorrentField) ([]*Torrent, error)

GetTorrents returns information requested by fields for the torrents identified by ids.

func (*Client) IsPortOpen

func (c *Client) IsPortOpen(ctx context.Context) (bool, error)

IsPortOpen reports if Transmission incoming port is accessible from the outside world.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L584

func (*Client) QueueMoveDown

func (c *Client) QueueMoveDown(ctx context.Context, ids Identifier) error

QueueMoveDown tells transmission to move torrents identified by ids down in the queue.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L601

func (*Client) QueueMoveToBottom

func (c *Client) QueueMoveToBottom(ctx context.Context, ids Identifier) error

QueueMoveToBottom tells Transmission to move torrents identified by ids to the bottom of the queue.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L601

func (*Client) QueueMoveToTop

func (c *Client) QueueMoveToTop(ctx context.Context, ids Identifier) error

QueueMoveToTop tells Transmission to move torrents identified by ids to the top of the queue.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L601

func (*Client) QueueMoveUp

func (c *Client) QueueMoveUp(ctx context.Context, ids Identifier) error

QueueMoveUp tells transmission to move torrents identified by ids up in the queue.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L601

func (*Client) ReannounceTorrents

func (c *Client) ReannounceTorrents(ctx context.Context, ids Identifier) error

ReannounceTorrents tells Transmission to reannounce (ask tracker for more peers) torrents identified by ids.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L86

func (*Client) RemoveTorrents

func (c *Client) RemoveTorrents(ctx context.Context, ids Identifier, removeData bool) error

RemoveTorrents removes torrens identified by ids. If removeData is true it also removes downloaded date.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L407

func (*Client) RenameTorrentPath

func (c *Client) RenameTorrentPath(ctx context.Context, id SingularIdentifier, path, name string) error

RenameTorrentPath renames a file or directory in a torrent.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L438

func (*Client) SetSession

func (c *Client) SetSession(ctx context.Context, req *SetSessionReq) error

SetSession applies given configuration to the current Transmission session. Only non-nil fields of the request have any effect.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L532

func (*Client) SetTorrents

func (c *Client) SetTorrents(ctx context.Context, ids Identifier, req *SetTorrentReq) error

SetTorrents modifies parameters for the torrents identified by ids.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L105

func (*Client) SetTorrentsLocation

func (c *Client) SetTorrentsLocation(ctx context.Context, ids Identifier, location string, move bool) error

SetTorrentsLocation set new location for torrents identified by ids to location. If move is true, existing files are moved to the new location. Otherwise new location is searched for files.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L421

func (*Client) StartTorrents

func (c *Client) StartTorrents(ctx context.Context, ids Identifier) error

StartTorrents starts torrents identified by ids. If Transmission already has enough torrents in its download or upload queues, the torrents are added to the end of the queue instead.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L86

func (*Client) StartTorrentsNow

func (c *Client) StartTorrentsNow(ctx context.Context, ids Identifier) error

StartTorrentsNow forcibly starts torrents identified by ids even of download or upload queues are full.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L86

func (*Client) UpdateBlocklist

func (c *Client) UpdateBlocklist(ctx context.Context) (int, error)

UpdateBlocklist updates peer blocklist and returns the size of newly obtained list.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L578

func (*Client) VerifyTorrents

func (c *Client) VerifyTorrents(ctx context.Context, ids Identifier) error

VerifyTorrents instructs Transmission to verify torrents identified by ids.

https://github.com/transmission/transmission/blob/46b3e6c8dae02531b1eb8907b51611fb9229b54a/extras/rpc-spec.txt#L86

type Cookie struct {
	Name  string
	Value string
}

Cookie is an HTTP cookie

func (*Cookie) String

func (c *Cookie) String() string

type Encryption

type Encryption int

Encryption specifies encryption configuration

const (
	EncryptionRequired  Encryption = iota // EncryptionRequired means Transmission requires encrypted connections for this torrent
	EncryptionPreferred                   // EncryptionPreferred means Transmission prefers encrypted connections for this torrent
	EncryptionTolerated                   // EncryptionTolerated means Transmission can use encrypted connections for this torrent
)

func OptEncryption

func OptEncryption(v Encryption) *Encryption

OptEncryption is a helper routine that allocates new Encryption to store v and returns a pointer to it.

func (Encryption) MarshalJSON

func (e Encryption) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaler for encryption configuration.

func (Encryption) String

func (e Encryption) String() string

String returns string representation of the encryption configuration.

func (*Encryption) UnmarshalJSON

func (e *Encryption) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaler for encryption configuration.

type ErrorType

type ErrorType int

ErrorType defines a category of torrent error.

const (
	ErrorTypeOK             ErrorType = 0 // ErrorTypeOK means no error
	ErrorTypeTrackerWarning ErrorType = 1 // ErrorTypeTrackerWarning indicates a warning from tracker
	ErrorTypeTrackerError   ErrorType = 2 // ErrorTypeTrackerError indicates an error from tracker
	ErrorTypeLocalError     ErrorType = 3 // ErrorTypeLocalError indicates a local problem
)

func (ErrorType) String

func (e ErrorType) String() string

type File

type File struct {
	// Name of the file
	Name string `json:"name"`
	// Size of the file
	Size int64 `json:"length"`
	// The amount of downloaded data
	Downloaded int64 `json:"bytesCompleted"`
}

File describes a single file within a torrent.

type FileStat

type FileStat struct {
	// The amount of downloaded data
	Downloaded int64 `json:"bytesCompleted"`
	// File priority
	Priority Priority `json:"priority"`
	// Indicates whether we want the file or not
	Wanted bool `json:"wanted"`
}

FileStat holds statistics about single file within a torrent.

type Hash

type Hash string

Hash identifier torrents by hash. It implements both Identifier and SingularIdentifier.

type ID

type ID int

ID identifies torrents. It implements both Identifier and SingularIdentifier.

type IDList

type IDList []SingularIdentifier

IDList is a list of torrent IDs

type Identifier

type Identifier interface {
	// contains filtered or unexported methods
}

Identifier can identify one or multiple torrents.

func All

func All() Identifier

All identifies all torrents.

func IDs

func IDs(ids ...SingularIdentifier) Identifier

IDs returns an identifier that identifies a list of provided torrents.

func RecentlyActive

func RecentlyActive() Identifier

RecentlyActive identifies torrents that have been active in the last hour.

type Limit

type Limit int

Limit controls whether a particular torrent follows global limits or not.

const (
	LimitGlobal    Limit = 0 // LimitGlobal configures torrent to honor global limit
	LimitLocal     Limit = 1 // LimitLocal configures torent to honor local torrent limit
	LimitUnlimited Limit = 2 // LimitUnlimited configures torrent to not honor any limit
)

func OptLimit

func OptLimit(v Limit) *Limit

OptLimit is a helper routine that allocates new Limit to store v and returns a pointer to it.

func (Limit) String

func (l Limit) String() string

type NewTorrent

type NewTorrent struct {
	ID   ID     `json:"id"`
	Hash Hash   `json:"hashString"`
	Name string `json:"name"`
}

NewTorrent describes newly added torrent.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option customizes client behaviour

func WithAuth

func WithAuth(user, pass string) Option

WithAuth sets username and password for authentication.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets HTTP client to use.

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent sets User-Agent value.

type Peer

type Peer struct {
	// Address of the peer
	Address net.IP `json:"address"`
	// Connection port
	Port int `json:"port"`
	// Name of the torrent client
	ClientName string `json:"clientName"`

	// Rate of downloading data from the peer
	DownloadRate int64 `json:"rateToClient"`
	// Rate of uploading data to the peer
	UploadRate int64 `json:"rateToPeer"`

	// Percentage of data peer has available
	Progress float64 `json:"progress"`

	// Indicates whether we are downloading from the peer
	IsDownloading bool `json:"isDownloadingFrom"`
	// Indicates whether we are uploading to the peer
	IsUploading bool `json:"isUploadingTo"`
	// Indicates whether we are connected via µTP
	IsUTP bool `json:"isUTP"`
	// Indicates whether peer is incoming or not
	IsIncoming bool `json:"isIncoming"`
	// Indicates if connection with the peer is encrypted
	IsEncrypted bool `json:"isEncrypted"`
	// Indicates whether Transmission is choked received from the client
	AreWeChoked bool `json:"clientIsChoked"`
	// Indicates whether peer is choked receiving from us
	IsPeerChoked bool `json:"peerIsChoked"`
	// Indicates whether we are interested in receiving data from the peer
	AreWeInterested bool `json:"clientIsInterested"`
	// Indicates whether peer is interested in receiveing data form us
	IsPeerInterested bool `json:"peerIsInterested"`
}

Peer identifies a single peer

type PeersOrigin

type PeersOrigin struct {
	// Number of peers from tracker
	Tracker int `json:"fromTracker"`
	// Number of incoming peers
	Incoming int `json:"fromIncoming"`
	// Number of peers from cache
	Cache int `json:"fromCache"`
	// Number of peers from DHT
	DHT int `json:"fromDht"`
	// Number of peers from local peer discovery
	LPD int `json:"fromLpd"`
	// Number of peers from peer exchange
	PEX int `json:"fromPex"`
	// Number of peers from LTEP handshake
	LTEP int `json:"fromLtep"`
}

PeersOrigin holds information about origin of the peers.

type Pieces

type Pieces []byte

Pieces holds info about downloaded pices

func (Pieces) IsDownloaded

func (p Pieces) IsDownloaded(piece int) bool

IsDownloaded returns true if the given piece is downloaded. It doesn't return an error if there is no such piece, but rather just returns false.

func (*Pieces) UnmarshalJSON

func (p *Pieces) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals pieces data from JSON

type Priority

type Priority int

Priority indicates torrent or file priority.

const (
	PriorityLow    Priority = -1 // PriorityLow indicates low priority
	PriorityNormal Priority = 0  // PriorityNormal indicates normal priority
	PriorityHigh   Priority = 1  // PriorityHigh indicates high priority
)

func OptPriority

func OptPriority(v Priority) *Priority

OptPriority is a helper routine that allocates new Priority to store v and returns a pointer to it.

func (Priority) String

func (p Priority) String() string

type Session

type Session struct {
	// ID of the current session
	ID string `json:"session-id"`

	// Maximum allowed download rate in "turtle" mode (bytes/s)
	TurtleDownloadRateLimit int64 `json:"alt-speed-down"`
	// Maximum allowed upload rate in "turtle" mode (bytes/s)
	TurtleUploadRateLimit int64 `json:"alt-speed-up"`
	// Indicates whether "turtle" mode is enabled right now
	TurtleEnabled bool `json:"alt-speed-enabled"`
	// Indicates whether "turtle" mode is controlled by the configured
	// schedule
	TurtleScheduleEnabled bool `json:"alt-speed-time-enabled"`
	// Indicates on what days of the week to turn on "turtle" mode
	TurtleScheduleOnDays Weekday `json:"alt-speed-time-day"`
	// When to turn on "turtle" mode (in minutes after midnight)
	TurtleScheduleStartsAt int `json:"alt-speed-time-begin"`
	// When to turn off "turtle" mode (in minutes after midnight)
	TurtleScheduleStopsAt int `json:"alt-speed-time-end"`

	// Maximum allowed download rate (bytes/s)
	DownloadRateLimit int64 `json:"speed-limit-down"`
	// Indicates whether download rate limit is enabled
	DownloadRateLimitEnabled bool `json:"speed-limit-down-enabled"`
	// Maximum allowed upload rate (bytes/s)
	UploadRateLimit int64 `json:"speed-limit-up"`
	// Indicates whether upload rate limit is enabled
	UploadRateLimitEnabled bool `json:"speed-limit-up-enabled"`

	// Location of the peer blocklist
	BlocklistURL string `json:"blocklist-url"`
	// Indicates whether or not peer blocklist is enabled
	BlocklistEnabled bool `json:"blocklist-enabled"`
	// Number of entries in the peer blocklist
	BlocklistSize int `json:"blocklist-size"`

	// Maximum size of disk cache in bytes
	CacheSize int64 `json:"cache-size-mb"`

	// Location of Transmission config directory
	ConfigDirectory string `json:"config-dir"`
	// Default path to download torrents
	DownloadDirectory string `json:"download-dir"`
	// Path for incomplete torrents (if enabled)
	IncompleteDirectory string `json:"incomplete-dir"`
	// Indicates whether to keep torrents in incomplete directory until done
	IncompleteDirectoryEnabled bool `json:"incomplete-dir-enabled"`
	// Indicates whether Transmission will append '.part' suffix to
	// incomplete files
	RenameIncompleteFiles bool `json:"rename-partial-files"`

	// Max number of torrents to download at once
	DownloadQueueLimit int `json:"download-queue-size"`
	// Indicates whether or not download queue limit is enabled
	DownloadQueueLimitEnabled bool `json:"download-queue-enabled"`
	// Max number of torrents to seed at once
	UploadQueueLimit int `json:"seed-queue-size"`
	// Indicates whether or not upload queue limit is enabled
	UploadQueueLimitEnabled bool `json:"seed-queue-enabled"`
	// Torrents that are idle for more than specified time aren't counted
	// toward download and upload queue limits
	QueueStalled time.Duration `json:"queue-stalled-minutes"`
	// Indicates whether or not to consider idle torrents as stalled
	QueueStalledEnabled bool `json:"queue-stalled-enabled"`
	// The default upload ratio for torrents
	UploadRatio float64 `json:"seedRatioLimit"`
	// Indicates whether or not to consider upload ration
	UploadRatioEnabled bool `json:"seedRatioLimited"`

	// Indicates whether DHT is allowed for public torrents
	DHTEnabled bool `json:"dht-enabled"`
	// Indicates whether local peer discovery is allowed for public torrents
	LPDEnabled bool `json:"lpd-enabled"`
	// Indicates whether peer exchange is allowed for public torrents
	PEXEnabled bool `json:"pex-enabled"`
	// Indicates whether µTP is allowed
	UTPEnabled bool `json:"utp-enabled"`

	// Peer encryption configuration
	Encryption Encryption `json:"encryption"`

	// Inactive seeding torrents will be stopped after this time
	IdleSeedingLimit time.Duration `json:"idle-seeding-limit"`
	// Indicates whether or not inactive seeding limit is enabled
	IdleSeedingLimitEnabled bool `json:"idle-seeding-limit-enabled"`

	// Maximum number of peers across all torrents
	GlobalPeerLimit int `json:"peer-limit-global"`
	// Maximum number of peers for a single torrent
	TorrentPeerLimit int `json:"peer-limit-per-torrent"`

	// Incoming peer port
	PeerPort int `json:"peer-port"`
	// Indicates whether Transmission randomizes peer port on start
	RandomizePeerPort bool `json:"peer-port-random-on-start"`
	// Indicates whether Transmission will try to request port forwading
	// using NAT-PMP or UPnP
	PortForwardingEnabled bool `json:"port-forwarding-enabled"`

	// Path to the script to run when torrent is done downloading
	ScriptPath string `json:"script-torrent-done-filename"`
	// Indicates whether to run script when torrent is done downloading or
	// not
	ScriptEnabled bool `json:"script-torrent-done-enabled"`

	// Indicates whether newly added torrents are started automatically or
	// not
	AutostartTorrents bool `json:"start-added-torrents"`
	// Indicates whether original torrent files are automatically deleted
	// or not
	RemoveTorrentFiles bool `json:"trash-original-torrent-files"`

	// Current RPC API version
	RPCVersion int `json:"rpc-version"`
	// Minimum supported RPC version
	RPCVersionMinimum int `json:"rpc-version-minimum"`
	// Transmission version
	Version string `json:"version"`

	// Value conversion units
	Units SessionUnits `json:"units"`
}

Session holds Transmission session information.

type SessionField added in v0.2.0

type SessionField string

SessionField is a field of Session

const (
	SessionFieldID                         SessionField = "session-id"
	SessionFieldTurtleDownloadRateLimit    SessionField = "alt-speed-down"
	SessionFieldTurtleUploadRateLimit      SessionField = "alt-speed-up"
	SessionFieldTurtleEnabled              SessionField = "alt-speed-enabled"
	SessionFieldTurtleScheduleEnabled      SessionField = "alt-speed-time-enabled"
	SessionFieldTurtleScheduleOnDays       SessionField = "alt-speed-time-day"
	SessionFieldTurtleScheduleStartsAt     SessionField = "alt-speed-time-begin"
	SessionFieldTurtleScheduleStopsAt      SessionField = "alt-speed-time-end"
	SessionFieldDownloadRateLimit          SessionField = "speed-limit-down"
	SessionFieldDownloadRateLimitEnabled   SessionField = "speed-limit-down-enabled"
	SessionFieldUploadRateLimit            SessionField = "speed-limit-up"
	SessionFieldUploadRateLimitEnabled     SessionField = "speed-limit-up-enabled"
	SessionFieldBlocklistURL               SessionField = "blocklist-url"
	SessionFieldBlocklistEnabled           SessionField = "blocklist-enabled"
	SessionFieldBlocklistSize              SessionField = "blocklist-size"
	SessionFieldCacheSize                  SessionField = "cache-size-mb"
	SessionFieldConfigDirectory            SessionField = "config-dir"
	SessionFieldDownloadDirectory          SessionField = "download-dir"
	SessionFieldIncompleteDirectory        SessionField = "incomplete-dir"
	SessionFieldIncompleteDirectoryEnabled SessionField = "incomplete-dir-enabled"
	SessionFieldRenameIncompleteFiles      SessionField = "rename-partial-files"
	SessionFieldDownloadQueueLimit         SessionField = "download-queue-size"
	SessionFieldDownloadQueueLimitEnabled  SessionField = "download-queue-enabled"
	SessionFieldUploadQueueLimit           SessionField = "seed-queue-size"
	SessionFieldUploadQueueLimitEnabled    SessionField = "seed-queue-enabled"
	SessionFieldQueueStalled               SessionField = "queue-stalled-minutes"
	SessionFieldQueueStalledEnabled        SessionField = "queue-stalled-enabled"
	SessionFieldUploadRatio                SessionField = "seedRatioLimit"
	SessionFieldUploadRatioEnabled         SessionField = "seedRatioLimited"
	SessionFieldDHTEnabled                 SessionField = "dht-enabled"
	SessionFieldLPDEnabled                 SessionField = "lpd-enabled"
	SessionFieldPEXEnabled                 SessionField = "pex-enabled"
	SessionFieldUTPEnabled                 SessionField = "utp-enabled"
	SessionFieldEncryption                 SessionField = "encryption"
	SessionFieldIdleSeedingLimit           SessionField = "idle-seeding-limit"
	SessionFieldIdleSeedingLimitEnabled    SessionField = "idle-seeding-limit-enabled"
	SessionFieldGlobalPeerLimit            SessionField = "peer-limit-global"
	SessionFieldTorrentPeerLimit           SessionField = "peer-limit-per-torrent"
	SessionFieldPeerPort                   SessionField = "peer-port"
	SessionFieldRandomizePeerPort          SessionField = "peer-port-random-on-start"
	SessionFieldPortForwardingEnabled      SessionField = "port-forwarding-enabled"
	SessionFieldScriptPath                 SessionField = "script-torrent-done-filename"
	SessionFieldScriptEnabled              SessionField = "script-torrent-done-enabled"
	SessionFieldAutostartTorrents          SessionField = "start-added-torrents"
	SessionFieldRemoveTorrentFiles         SessionField = "trash-original-torrent-files"
	SessionFieldRPCVersion                 SessionField = "rpc-version"
	SessionFieldRPCVersionMinimum          SessionField = "rpc-version-minimum"
	SessionFieldVersion                    SessionField = "version"
	SessionFieldUnits                      SessionField = "units"
)

type SessionStats

type SessionStats struct {
	// Total number of torrents
	Torrents int `json:"torrentCount"`
	// Number of active torrents
	ActiveTorrents int `json:"activeTorrentCount"`
	// Number of paused torrents
	PausedTorrents int `json:"pausedTorrentCount"`

	// Cumulative download rate (bytes/s)
	DownloadRate int64 `json:"downloadSpeed"`
	// Cumulative upload rate (bytes/s)
	UploadRate int64 `json:"uploadSpeed"`

	// Statistics about current session
	CurrentSession Stats `json:"current-stats"`
	// Statistics about all sessesions (including current)
	AllSessions Stats `json:"cumulative-stats"`
}

SessionStats holds session statistics

type SessionUnits

type SessionUnits struct {
	// KB/s, MB/s, GB/s, TB/s
	Speed []string `json:"speed-units"`
	// Number of bytes per KB
	SpeedBytesPerKB int `json:"speed-bytes"`
	// KB, MB, GB, TB
	Size []string `json:"size-units"`
	// Number of bytes per KB
	SizeBytesPerKB int `json:"size-bytes"`
	// KB, MB, GB, TB
	Memory []string `json:"memory-units"`
	// Number of bytes per KB
	MemoryBytesPerKB int `json:"memory-bytes"`
}

SessionUnits holds value conversion units.

type SetSessionReq

type SetSessionReq struct {
	// Maximum allowed download rate in "turtle" mode (bytes/s)
	TurtleDownloadRateLimit *int64 `json:"-"`
	// Maximum allowed upload rate in "turtle" mode (bytes/s)
	TurtleUploadRateLimit *int64 `json:"-"`
	// Indicates whether "turtle" mode is enabled right now
	TurtleEnabled *bool `json:"alt-speed-enabled,omitempty"`
	// Indicates whether "turtle" mode is controlled by the configured
	// schedule
	TurtleScheduleEnabled *bool `json:"alt-speed-time-enabled,omitempty"`
	// Indicates on what days of the week to turn on "turtle" mode
	TurtleScheduleOnDays *Weekday `json:"alt-speed-time-day,omitempty"`
	// When to turn on "turtle" mode (in minutes after midnight)
	TurtleScheduleStartsAt *int `json:"alt-speed-time-begin,omitempty"`
	// When to turn off "turtle" mode (in minutes after midnight)
	TurtleScheduleStopsAt *int `json:"alt-speed-time-end,omitempty"`

	// Maximum allowed download rate (bytes/s)
	DownloadRateLimit *int64 `json:"-"`
	// Indicates whether download rate limit is enabled
	DownloadRateLimitEnabled *bool `json:"speed-limit-down-enabled,omitempty"`
	// Maximum allowed upload rate (bytes/s)
	UploadRateLimit *int64 `json:"-"`
	// Indicates whether upload rate limit is enabled
	UploadRateLimitEnabled *bool `json:"speed-limit-up-enabled,omitempty"`

	// Location of the peer blocklist
	BlocklistURL *string `json:"blocklist-url,omitempty"`
	// Indicates whether or not peer blocklist is enabled
	BlocklistEnabled *bool `json:"blocklist-enabled,omitempty"`

	// Maximum size of disk cache in bytes
	CacheSize *int64 `json:"-"`

	// Default path to download torrents
	DownloadDirectory *string `json:"download-dir,omitempty"`
	// Path for incomplete torrents (if enabled)
	IncompleteDirectory *string `json:"incomplete-dir,omitempty"`
	// Indicates whether to keep torrents in incomplete directory until done
	IncompleteDirectoryEnabled *bool `json:"incomplete-dir-enabled,omitempty"`
	// Indicates whether Transmission will append '.part' suffix to
	// incomplete files
	RenameIncompleteFiles *bool `json:"rename-partial-files,omitempty"`

	// Max number of torrents to download at once
	DownloadQueueLimit *int `json:"download-queue-size,omitempty"`
	// Indicates whether or not download queue limit is enabled
	DownloadQueueLimitEnabled *bool `json:"download-queue-enabled,omitempty"`
	// Max number of torrents to seed at once
	UploadQueueLimit *int `json:"seed-queue-size,omitempty"`
	// Indicates whether or not upload queue limit is enabled
	UploadQueueLimitEnabled *bool `json:"seed-queue-enabled,omitempty"`
	// Torrents that are idle for more than specified time aren't counted
	// toward download and upload queue limits
	QueueStalled *time.Duration `json:"-"`
	// Indicates whether or not to consider idle torrents as stalled
	QueueStalledEnabled *bool `json:"queue-stalled-enabled,omitempty"`
	// The default upload ratio limit for torrents
	UploadRatioLimit *float64 `json:"seedRatioLimit,omitempty"`
	// Indicates whether or not to consider upload ration
	UploadRatioLimitEnabled *bool `json:"seedRatioLimited,omitempty"`

	// Indicates whether DHT is allowed for public torrents
	DHTEnabled *bool `json:"dht-enabled,omitempty"`
	// Indicates whether local peer discovery is allowed for public torrents
	LPDEnabled *bool `json:"lpd-enabled,omitempty"`
	// Indicates whether peer exchange is allowed for public torrents
	PEXEnabled *bool `json:"pex-enabled,omitempty"`
	// Indicates whether µTP is allowed
	UTPEnabled *bool `json:"utp-enabled,omitempty"`

	// Peer encryption configuration
	Encryption *Encryption `json:"encryption,omitempty"`

	// Inactive seeding torrents will be stopped after this time
	IdleSeedingLimit *time.Duration `json:"-"`
	// Indicates whether or not inactive seeding limit is enabled
	IdleSeedingLimitEnabled *bool `json:"idle-seeding-limit-enabled,omitempty"`

	// Maximum number of peers across all torrents
	GlobalPeerLimit *int `json:"peer-limit-global,omitempty"`
	// Maximum number of peers for a single torrent
	TorrentPeerLimit *int `json:"peer-limit-per-torrent,omitempty"`

	// Incoming peer port
	PeerPort *int `json:"peer-port,omitempty"`
	// Indicates whether Transmission randomizes peer port on start
	RandomizePeerPort *bool `json:"peer-port-random-on-start,omitempty"`
	// Indicates whether Transmission will try to request port forwading
	// using NAT-PMP or UPnP
	PortForwardingEnabled *bool `json:"port-forwarding-enabled,omitempty"`

	// Path to the script to run when torrent is done downloading
	ScriptPath *string `json:"script-torrent-done-filename,omitempty"`
	// Indicates whether to run script when torrent is done downloading or
	// not
	ScriptEnabled *bool `json:"script-torrent-done-enabled,omitempty"`

	// Indicates whether newly added torrents are started automatically or
	// not
	AutostartTorrents *bool `json:"start-added-torrents,omitempty"`
	// Indicates whether original torrent files are automatically deleted
	// or not
	RemoveTorrentFiles *bool `json:"trash-original-torrent-files,omitempty"`
}

SetSessionReq holds modifications to be applied to current session. Only non-nil values are taken into account.

type SetTorrentReq

type SetTorrentReq struct {
	// Torrent download rate limit (bytes/s)
	DownloadRateLimit *int64 `json:"-"`
	// Honor torrent download rate limit
	DownloadRateLimitEnabled *bool `json:"downloadLimited,omitempty"`
	// Torrent upload rate limit (bytes/s)
	UploadRateLimit *int64 `json:"-"`
	// Honor torrent upload rate limit
	UploadRateLimitEnabled *bool `json:"uploadLimited,omitempty"`
	// Whether to honor session download/upload limits or not
	HonorSessionLimits *bool `json:"honorsSessionLimits,omitempty"`

	// Torrent priority
	Priority *Priority `json:"bandwidthPriority,omitempty"`
	// An array of high priority file indicies (empty array means all
	// files)
	HighPriorityFiles []int `json:"priority-high"`
	// An array of normal priority file indicies (empty array means all
	// files)
	NormalPriorityFiles []int `json:"priority-normal"`
	// An array of low priority file indicies (empty array means all files)
	LowPriorityFiles []int `json:"priority-low"`
	// Position of this torrent in the queue
	PositionInQueue *int `json:"queuePosition,omitempty"`

	// Indicies of files to download (empty array means all files)
	WantedFiles []int `json:"files-wanted"`
	// Indicies of files to not download (empty array means all files)
	UnwantedFiles []int `json:"files-unwanted"`

	// Maximum number of peers
	PeerLimit *int `json:"peer-limit,omitempty"`

	// New location of the torrent contents
	Location *string `json:"location,omitempty"`

	// Torrent labels
	Labels []string `json:"labels"`

	// Stop torrent after given time of inactivity
	IdleSeedingLimit *time.Duration `json:"-"`
	// Which IdleSeedingLimit value to use
	IdleSeedingLimitMode *Limit `json:"seedIdleMode,omitempty"`
	// Stop seeding after reaching the given ratio
	UploadRatioLimit *float64 `json:"seedRatioLimit,omitempty"`
	// Which UploadRatioLimit value to use
	UploadRatioLimitMode *Limit `json:"seedRatioMode,omitempty"`

	// Add trackers with the given URIs to the torrent
	TrackersToAdd []*url.URL `json:"-"`
	// Remove trackers with the given ids from the torrent
	TrackerToRemove []int `json:"trackerRemove,omitempty"`
	// List of trackers with updated announcement URIs
	TrackersToReplace []TrackerReplacement `json:"-"`
}

SetTorrentReq holds input for SetTorrent request.

type SingularIdentifier

type SingularIdentifier interface {
	// contains filtered or unexported methods
}

SingularIdentifier can identify exactly one torrent.

type Stats

type Stats struct {
	// Total amount of downloaded data (bytes)
	Downloaded int64 `json:"downloadedBytes"`
	// Total amount of uploaded data (bytes)
	Uploaded int64 `json:"uploadedBytes"`
	// Total number of added files
	Files int `json:"filesAdded"`
	// Number of sessions (always 1 for current session).
	Sessions int `json:"sessionCount"`
	// The amount of time the session has been active.
	ActiveFor time.Duration `json:"secondsActive"`
}

Stats contains statistics about current sessions or cumulative statistics about all sessions.

type Status

type Status int

Status indicates torrent status

const (
	StatusStopped      Status = 0 // StatusStopped indicates that torrent is stopped
	StatusCheckWait    Status = 1 // StatusCheckWait indicates that torrent is queued for checking
	StatusCheck        Status = 2 // StatusCheck indicates that torrent is being checked
	StatusDownloadWait Status = 3 // StatusDownloadWait indicates that torrent is queued for downloading
	StatusDownload     Status = 4 // StatusDownload indicates that torrent is being downloaded
	StatusSeedWait     Status = 5 // StatusSeedWait indicates that torrent is queued for seeding
	StatusSeed         Status = 6 // StatusSeed indicates that torrent is being seeded
)

func (Status) String

func (s Status) String() string

type Torrent

type Torrent struct {
	// ID of the torrent
	ID ID `json:"id"`
	// Hash of the torrent
	Hash Hash `json:"hashString"`
	// Name of the torrent
	Name string `json:"name"`
	// Current torrent status
	Status Status `json:"status"`
	// Torrent creator
	Creator string `json:"creator"`
	// An optional commen
	Comment string `json:"comment"`
	// Torrent labels
	Labels []string `json:"labels"`

	// ETA until the torrent is done. This is 0 if ETA is unknown or not
	// available
	ETA time.Duration `json:"eta"`
	// ETA until the idle time limit is reached if seeding
	IdleETA time.Duration `json:"etaIdle"`

	// Type of error
	ErrorType ErrorType `json:"error"`
	// Error message
	Error string `json:"errorString"`

	// Path to torrent file
	File string `json:"torrentFile"`
	// Torrent magnet link
	MagnetLink string `json:"magnetLink"`
	// Torrent download directory
	DownloadDirectory string `json:"downloadDir"`

	// Torrent creation date
	CreatedAt time.Time `json:"-" field:"dateCreated"`
	// Timestamp of the last metadata update
	LastEditedAt time.Time `json:"-" field:"editDate"`
	// Date when torrent was added
	AddedAt time.Time `json:"-" field:"addedDate"`
	// Date when torrent was created
	StartedAt time.Time `json:"-" field:"startDate"`
	// Date when torrent was last active
	LastActiveAt time.Time `json:"-" field:"activityDate"`
	// Date when torrent was completed
	DoneAt time.Time `json:"-" field:"doneDate"`
	// Time when one of the trackers will allow to manually ask for more
	// peers
	CanManuallyAnnounceAt time.Time `json:"-" field:"manualAnnounceTime"`

	// Current download rate
	DownloadRate int64 `json:"rateDownload"`
	// Current upload rate
	UploadRate int64 `json:"rateUpload"`
	// Download rate limit
	DownloadRateLimit int64 `json:"downloadLimit"`
	// Indicates if download rate is limited
	DownloadRateLimitEnabled bool `json:"downloadLimited"`
	// Upload rate limit
	UploadRateLimit int64 `json:"uploadLimit"`
	// Indicates if upload rate is limited
	UploadRateLimited bool `json:"uploadLimited"`
	// Idicates if session limits are honored for this torrent
	HonorSessionLimits bool `json:"honorsSessionLimits"`

	// Total amount of data downloaded for this torrent
	DownloadedTotal int64 `json:"downloadedEver"`
	// Total amount of data uploaded for this torrent
	UploadedTotal int64 `json:"uploadedEver"`
	// Total amount of corrupted data downloaded for this torrent
	CorruptedTotal int64 `json:"corruptEver"`

	// Bandwidth priority
	Priority Priority `json:"bandwidthPriority"`
	// Position in queue
	PositionInQueue int `json:"queuePosition"`

	// Stop torrent after given time of inactivity
	IdleSeedingLimit time.Duration `json:"seedIdleLimit"`
	// Which IdleSeedingLimit value to use
	IdleSeedingLimitMode Limit `json:"seedIdleMode"`
	// Stop seeding after reaching the given ratio
	UploadRatioLimit float64 `json:"seedRatioLimit"`
	// Which UploadRatioLimit value to use
	UploadRatioLimitMode Limit `json:"seedRatioMode"`
	// Current upload ration
	UploadRatio float64 `json:"uploadRatio"`

	// Time spent downloading this torrent
	DownloadingFor time.Duration `json:"secondsDownloading"`
	// Time spent uploading this torrent
	SeedingFor time.Duration `json:"secondsSeeding"`

	// Total size of all files in the torrent
	TotalSize int64 `json:"totalSize"`
	// Size of wanted files in the torrent
	WantedSize int64 `json:"sizeWhenDone"`
	// Size of wanted files that is available for download from peers
	WantedAvailable int64 `json:"desiredAvailable"`
	// Size of yet to download wanted files
	WantedLeft int64 `json:"leftUntilDone"`
	// Total amount of downloaded but not yet checked data
	UncheckedSize int64 `json:"haveUnchecked"`
	// Total amount of downloaded and checked data
	ValidSize int64 `json:"haveValid"`

	// Percentage of data completed
	DataDone float64 `json:"percentDone"`
	// Percentage of data checked
	DataChecked float64 `json:"recheckProgress"`
	// Percentage of metadata completed
	MetadataDone float64 `json:"metadataPercentComplete"`

	// Is torrent finished (met its seeding ration)
	IsFinished bool `json:"isFinished"`
	// Is torrent private
	IsPrivate bool `json:"isPrivate"`
	// Is torrent stalled
	IsStalled bool `json:"isStalled"`

	// Maximum allowed number of peers
	PeerLimit int `json:"peer-limit"`
	// Current number of peers
	ConnectedPeers int `json:"peersConnected"`
	// Number of peers getting data from us
	PeersGettingFromUs int `json:"peersGettingFromUs"`
	// Number of peers sending data to us
	PeersSendingToUs int `json:"peersSendingToUs"`
	// Array of peer descriptors
	Peers []Peer `json:"peers"`
	// Origin of the peers
	PeersFrom PeersOrigin `json:"peersFrom"`
	// Number of web seeds seeding to us
	WebSeedsSendingToUs int `json:"webseedsSendingToUs"`
	// Array of web seeds
	WebSeeds []string `json:"webseeds"`

	// An array the size of number of files with boolean flag indicating
	// whether we want the file or not
	Wanted []bool `json:"-" field:"wanted"`
	// Array of files in the torrent
	Files []File `json:"files"`
	// File statistics
	FileStats []FileStat `json:"fileStats"`
	// An array of file priorities
	Priorities []Priority `json:"priorities"`

	// Number of pieces
	PieceCount int64 `json:"pieceCount"`
	// Size of each piece
	PieceSize int64 `json:"pieceSize"`
	// Pieces holds info about downloaded torren pieces
	Pieces Pieces `json:"pieces"`

	// Trackers holds the list of torrent trackers
	Trackers []Tracker `json:"-" field:"trackers"`
	// TrackerStats holds statistics about trackers
	TrackerStats []TrackerStat `json:"-" field:"trackerStats"`
}

Torrent describes a torrent file.

type TorrentField

type TorrentField string

TorrentField is a field of Torrent

const (
	TorrentFieldID                       TorrentField = "id"
	TorrentFieldHash                     TorrentField = "hashString"
	TorrentFieldName                     TorrentField = "name"
	TorrentFieldStatus                   TorrentField = "status"
	TorrentFieldCreator                  TorrentField = "creator"
	TorrentFieldComment                  TorrentField = "comment"
	TorrentFieldLabels                   TorrentField = "labels"
	TorrentFieldETA                      TorrentField = "eta"
	TorrentFieldIdleETA                  TorrentField = "etaIdle"
	TorrentFieldErrorType                TorrentField = "error"
	TorrentFieldError                    TorrentField = "errorString"
	TorrentFieldFile                     TorrentField = "torrentFile"
	TorrentFieldMagnetLink               TorrentField = "magnetLink"
	TorrentFieldDownloadDirectory        TorrentField = "downloadDir"
	TorrentFieldCreatedAt                TorrentField = "dateCreated"
	TorrentFieldLastEditedAt             TorrentField = "editDate"
	TorrentFieldAddedAt                  TorrentField = "addedDate"
	TorrentFieldStartedAt                TorrentField = "startDate"
	TorrentFieldLastActiveAt             TorrentField = "activityDate"
	TorrentFieldDoneAt                   TorrentField = "doneDate"
	TorrentFieldCanManuallyAnnounceAt    TorrentField = "manualAnnounceTime"
	TorrentFieldDownloadRate             TorrentField = "rateDownload"
	TorrentFieldUploadRate               TorrentField = "rateUpload"
	TorrentFieldDownloadRateLimit        TorrentField = "downloadLimit"
	TorrentFieldDownloadRateLimitEnabled TorrentField = "downloadLimited"
	TorrentFieldUploadRateLimit          TorrentField = "uploadLimit"
	TorrentFieldUploadRateLimited        TorrentField = "uploadLimited"
	TorrentFieldHonorSessionLimits       TorrentField = "honorsSessionLimits"
	TorrentFieldDownloadedTotal          TorrentField = "downloadedEver"
	TorrentFieldUploadedTotal            TorrentField = "uploadedEver"
	TorrentFieldCorruptedTotal           TorrentField = "corruptEver"
	TorrentFieldPriority                 TorrentField = "bandwidthPriority"
	TorrentFieldPositionInQueue          TorrentField = "queuePosition"
	TorrentFieldIdleSeedingLimit         TorrentField = "seedIdleLimit"
	TorrentFieldIdleSeedingLimitMode     TorrentField = "seedIdleMode"
	TorrentFieldUploadRatioLimit         TorrentField = "seedRatioLimit"
	TorrentFieldUploadRatioLimitMode     TorrentField = "seedRatioMode"
	TorrentFieldUploadRatio              TorrentField = "uploadRatio"
	TorrentFieldDownloadingFor           TorrentField = "secondsDownloading"
	TorrentFieldSeedingFor               TorrentField = "secondsSeeding"
	TorrentFieldTotalSize                TorrentField = "totalSize"
	TorrentFieldWantedSize               TorrentField = "sizeWhenDone"
	TorrentFieldWantedAvailable          TorrentField = "desiredAvailable"
	TorrentFieldWantedLeft               TorrentField = "leftUntilDone"
	TorrentFieldUncheckedSize            TorrentField = "haveUnchecked"
	TorrentFieldValidSize                TorrentField = "haveValid"
	TorrentFieldDataDone                 TorrentField = "percentDone"
	TorrentFieldDataChecked              TorrentField = "recheckProgress"
	TorrentFieldMetadataDone             TorrentField = "metadataPercentComplete"
	TorrentFieldIsFinished               TorrentField = "isFinished"
	TorrentFieldIsPrivate                TorrentField = "isPrivate"
	TorrentFieldIsStalled                TorrentField = "isStalled"
	TorrentFieldPeerLimit                TorrentField = "peer-limit"
	TorrentFieldConnectedPeers           TorrentField = "peersConnected"
	TorrentFieldPeersGettingFromUs       TorrentField = "peersGettingFromUs"
	TorrentFieldPeersSendingToUs         TorrentField = "peersSendingToUs"
	TorrentFieldPeers                    TorrentField = "peers"
	TorrentFieldPeersFrom                TorrentField = "peersFrom"
	TorrentFieldWebSeedsSendingToUs      TorrentField = "webseedsSendingToUs"
	TorrentFieldWebSeeds                 TorrentField = "webseeds"
	TorrentFieldWanted                   TorrentField = "wanted"
	TorrentFieldFiles                    TorrentField = "files"
	TorrentFieldFileStats                TorrentField = "fileStats"
	TorrentFieldPriorities               TorrentField = "priorities"
	TorrentFieldPieceCount               TorrentField = "pieceCount"
	TorrentFieldPieceSize                TorrentField = "pieceSize"
	TorrentFieldPieces                   TorrentField = "pieces"
	TorrentFieldTrackers                 TorrentField = "trackers"
	TorrentFieldTrackerStats             TorrentField = "trackerStats"
)

type Tracker

type Tracker struct {
	ID          int      `json:"id"`
	Tier        int      `json:"tier"`
	AnnounceURL *url.URL `json:"-"`
	ScrapeURL   *url.URL `json:"-"`
}

Tracker describes a single tracker

type TrackerReplacement

type TrackerReplacement struct {
	ID          int
	AnnounceURL *url.URL
}

TrackerReplacement contains a replacement announce URL for a tracker.

type TrackerStat

type TrackerStat struct {
	ID          int      `json:"id"`
	Tier        int      `json:"tier"`
	IsBackup    bool     `json:"isBackup"`
	Host        *url.URL `json:"-"`
	AnnounceURL *url.URL `json:"-"`
	ScrapeURL   *url.URL `json:"-"`

	Leechers  int `json:"leecherCount"`
	Seeders   int `json:"seederCount"`
	Downloads int `json:"downloadCount"`

	HasAnnounced            bool         `json:"hasAnnounced"`
	AnnounceState           TrackerState `json:"announceState"`
	LastAnnounceStartTime   time.Time    `json:"-"`
	LastAnnounceTime        time.Time    `json:"-"`
	IsLastAnnounceTimedOut  bool         `json:"lastAnnounceTimedOut"`
	IsLastAnnounceSucceeded bool         `json:"lastAnnounceSucceeded"`
	LastAnnounceResult      string       `json:"lastAnnounceResult"`
	LastAnnouncePeerCount   int          `json:"lastAnnouncePeerCount"`
	NextAnnounceTime        time.Time    `json:"-"`

	HasScraped            bool         `json:"hasScraped"`
	ScrapeState           TrackerState `json:"scrapeState"`
	LastScrapeStartTime   time.Time    `json:"-"`
	LastScrapeTime        time.Time    `json:"-"`
	IsLastScrapeTimedOut  bool         `json:"-"`
	IsLastScrapeSucceeded bool         `json:"lastScrapeSucceeded"`
	LastScrapeResult      string       `json:"lastScrapeResult"`
	NextScrapeTime        time.Time    `json:"-"`
}

TrackerStat holds stats for a single tracker.

type TrackerState

type TrackerState int

TrackerState defines a state of a tracker.

const (
	TrackerStateInactive TrackerState = 0 // TrackerStateInactive indicates that Transmission is not announcing to tracker
	TrackerStateWaiting  TrackerState = 1 // TrackerStateWaiting indicates that Transmission is waiting to announce to tracker
	TrackerStateQueued   TrackerState = 2 // TrackerStateQueued indicates that Transmission has queued the announce to tracker
	TrackerStateActive   TrackerState = 3 // TrackerStateActive indicates that Transmission has announced to tracker
)

func (TrackerState) String

func (t TrackerState) String() string

type Weekday

type Weekday int

Weekday specifies a day of the week.

const (
	Sunday    Weekday = (1 << iota) // Sunday is a day of week
	Monday                          // Monday is a day of week
	Tuesday                         // Tuesday is a day of week
	Wednesday                       // Wednesday is a day of week
	Thursday                        // Thursday is a day of week
	Friday                          // Friday is a day of week
	Saturday                        // Saturday is a day of week

)

func OptWeekday

func OptWeekday(v Weekday) *Weekday

OptWeekday is a helper routine that allocates new Weekday to store v and returns a pointer to it.

func (Weekday) String

func (d Weekday) String() string

String returns an English name of the day taking into account special day combination, like weekday or weekend.

Jump to

Keyboard shortcuts

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