transrpc

package module
v0.0.0-...-55cdb83 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MIT Imports: 14 Imported by: 0

README

transrpc GoDoc Build Status

Package transrpc provides a Go idiomatic Transmission RPC client, primarily for use by the command-line tool transctl.

Installing

Install in the usual Go fashion:

$ go get -u github.com/kenshaw/transrpc

Using

transrpc can be used similar to the following:

// _example/example.go
package main

import (
	"context"
	"log"

	"github.com/kenshaw/transrpc"
)

func main() {
	cl := transrpc.NewClient(
		transrpc.WithHost("user:pass@my-host:9091"),
	)

	res, err := cl.TorrentGet(context.Background())
	if err != nil {
		log.Fatal(err)
	}

	for _, torrent := range res.Torrents {
		log.Printf("> ID: %d Name: %s Hash: %s", torrent.ID, torrent.Name, torrent.HashString)
	}
}

Additionally, a more complex example used to remove a completed torrent upon notification is available here.

Documentation

Overview

Package transrpc provides a client for Transmission RPC hosts.

See: https://github.com/transmission/transmission/blob/master/extras/rpc-spec.txt

Index

Constants

View Source
const (
	// DefaultTimeout is the default client timeout.
	DefaultTimeout = 10 * time.Second

	// DefaultUserAgent is the default client user agent.
	DefaultUserAgent = "transrpc/0.1"
)
View Source
const (
	// RecentlyActive is the recently active identifier.
	RecentlyActive = "recently-active"
)

Variables

This section is empty.

Functions

func DefaultTorrentGetFields

func DefaultTorrentGetFields() []string

DefaultTorrentGetFields returns the list of all torrent field names.

Types

type BlocklistUpdateRequest

type BlocklistUpdateRequest struct{}

BlocklistUpdateRequest is the blocklist update request.

func BlocklistUpdate

func BlocklistUpdate() *BlocklistUpdateRequest

BlocklistUpdate creates a blocklist update request.

func (*BlocklistUpdateRequest) Do

func (req *BlocklistUpdateRequest) Do(ctx context.Context, cl *Client) (int64, error)

Do executes the blocklist update request against the provided context and client.

type Bool

type Bool bool

Bool wraps int64.

func (Bool) MarshalJSON

func (b Bool) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface.

func (Bool) MarshalYAML

func (b Bool) MarshalYAML() (interface{}, error)

MarshalYAML satisfies the yaml.Marshaler interface.

func (*Bool) UnmarshalJSON

func (b *Bool) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type ByteCount

type ByteCount int64

ByteCount wraps a byte count as int64.

func (ByteCount) Add

func (bc ByteCount) Add(i interface{}) interface{}

Add adds i to the byte count.

func (ByteCount) Format

func (bc ByteCount) Format(asIEC bool, prec int) string

Format formats the byte count.

func (ByteCount) Int64

func (bc ByteCount) Int64() int64

Int64 returns the byte count as an int64.

func (ByteCount) String

func (bc ByteCount) String() string

String satisfies the fmt.Stringer interface.

type Client

type Client struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Client is a transmission rpc client.

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient issues a new transmission rpc client.

func (*Client) BlocklistUpdate

func (cl *Client) BlocklistUpdate(ctx context.Context) (int64, error)

BlocklistUpdate issues a blocklist update request.

func (*Client) Do

func (cl *Client) Do(ctx context.Context, method string, arguments, v interface{}) error

Do executes the transmission rpc method, json marshaling the passed arguments and unmarshaling the response to v (if provided).

func (*Client) FreeSpace

func (cl *Client) FreeSpace(ctx context.Context, path string) (ByteCount, error)

FreeSpace issues a free space request.

func (*Client) PortTest

func (cl *Client) PortTest(ctx context.Context) (bool, error)

PortTest issues a port test request.

func (*Client) QueueMoveBottom

func (cl *Client) QueueMoveBottom(ctx context.Context, ids ...interface{}) error

QueueMoveBottom creates a queue move bottom request for the specified ids.

func (*Client) QueueMoveDown

func (cl *Client) QueueMoveDown(ctx context.Context, ids ...interface{}) error

QueueMoveDown creates a queue move down request for the specified ids.

func (*Client) QueueMoveTop

func (cl *Client) QueueMoveTop(ctx context.Context, ids ...interface{}) error

QueueMoveTop creates a queue move top request for the specified ids.

func (*Client) QueueMoveUp

func (cl *Client) QueueMoveUp(ctx context.Context, ids ...interface{}) error

QueueMoveUp creates a queue move up request for the specified ids.

func (*Client) SessionClose

func (cl *Client) SessionClose(ctx context.Context) error

SessionClose issues a session close request.

func (*Client) SessionGet

func (cl *Client) SessionGet(ctx context.Context) (*SessionGetResponse, error)

SessionGet issues a session get request.

func (*Client) SessionSet

func (cl *Client) SessionSet(ctx context.Context, req *SessionSetRequest) error

SessionSet issues a session set request.

func (*Client) SessionShutdown

func (cl *Client) SessionShutdown(ctx context.Context) error

SessionShutdown issues a session close request.

Alias for SessionClose.

func (*Client) SessionStats

func (cl *Client) SessionStats(ctx context.Context) (*SessionStatsResponse, error)

SessionStats issues a session stats request.

func (*Client) TorrentAdd

func (cl *Client) TorrentAdd(ctx context.Context, req *TorrentAddRequest) (*TorrentAddResponse, error)

TorrentAdd issues a torrent add request for the specified ids.

func (*Client) TorrentGet

func (cl *Client) TorrentGet(ctx context.Context, ids ...interface{}) (*TorrentGetResponse, error)

TorrentGet issues a torrent get request for the specified ids.

func (*Client) TorrentReannounce

func (cl *Client) TorrentReannounce(ctx context.Context, ids ...interface{}) error

TorrentReannounce issues a torrent reannounce request for the specified ids.

func (*Client) TorrentRemove

func (cl *Client) TorrentRemove(ctx context.Context, deleteLocalData bool, ids ...interface{}) error

TorrentRemove issues a torrent remove request for the specified ids.

func (*Client) TorrentRenamePath

func (cl *Client) TorrentRenamePath(ctx context.Context, path, name string, ids ...interface{}) error

TorrentRenamePath issues a torrent start request for the specified ids.

func (*Client) TorrentSet

func (cl *Client) TorrentSet(ctx context.Context, req *TorrentSetRequest) error

TorrentSet issues a torrent start request for the specified ids.

func (*Client) TorrentSetLocation

func (cl *Client) TorrentSetLocation(ctx context.Context, location string, move bool, ids ...interface{}) error

TorrentSetLocation issues a torrent set location request for the specified ids.

func (*Client) TorrentStart

func (cl *Client) TorrentStart(ctx context.Context, ids ...interface{}) error

TorrentStart issues a torrent start request for the specified ids.

func (*Client) TorrentStartNow

func (cl *Client) TorrentStartNow(ctx context.Context, ids ...interface{}) error

TorrentStartNow issues a torrent start now request for the specified ids.

func (*Client) TorrentStop

func (cl *Client) TorrentStop(ctx context.Context, ids ...interface{}) error

TorrentStop issues a torrent stop request for the specified ids.

func (*Client) TorrentVerify

func (cl *Client) TorrentVerify(ctx context.Context, ids ...interface{}) error

TorrentVerify issues a torrent verify request for the specified ids.

type ClientOption

type ClientOption = func(*Client)

ClientOption is a transmission rpc client option.

func WithCSRF

func WithCSRF(csrf string) ClientOption

WithCSRF is a transmission rpc client option to set the CSRF token used.

func WithCredentialFallback

func WithCredentialFallback(user, pass string) ClientOption

WithCredentialFallback is a transmission rpc client option to set the credential fallback to send to the rpc host.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

WithHTTPClient is a transmission rpc client option to set the underlying http.Client used.

func WithHost

func WithHost(host string) ClientOption

WithHost is a transmission rpc client option to set the remote host. Remote URL will become 'http://<host>/transmission/rpc'.

func WithLogf

func WithLogf(req, res func(string, ...interface{})) ClientOption

WithLogf is a transmission rpc client option to set logging handlers HTTP request and response bodies.

func WithRetries

func WithRetries(retries int) ClientOption

WithRetries is a transmission rpc client option to set the number of retry attempts when a failure is encountered.

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

WithTimeout is a transmission rpc client option to set the rpc host request tiemout.

func WithURL

func WithURL(urlstr string) ClientOption

WithURL is a transmission rpc client option to set the remote URL.

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

WithUserAgent is a transmission rpc client option to set the user agent sent to the rpc host.

type Duration

type Duration time.Duration

Duration wraps time.Duration.

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface.

func (Duration) MarshalYAML

func (d Duration) MarshalYAML() (interface{}, error)

MarshalYAML satisfies the yaml.Marshaler interface.

func (Duration) String

func (d Duration) String() string

String satisfies the fmt.Stringer interface.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type Encryption

type Encryption string

Encryption is the list of encryption types.

const (
	EncryptionRequired  Encryption = "required"
	EncryptionPreferred Encryption = "preferred"
	EncryptionTolerated Encryption = "tolerated"
)

Encryption types

func (Encryption) String

func (t Encryption) String() string

Strings satisfies the fmt.Stringer interface.

func (*Encryption) UnmarshalJSON

func (t *Encryption) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type ErrNo

type ErrNo int64

ErrNo wraps remote errors.

func (ErrNo) String

func (errNo ErrNo) String() string

String satisifies the fmt.Stringer interface.

type ErrRequestFailed

type ErrRequestFailed struct {
	Err string
}

ErrRequestFailed wraps a failed request error.

func (*ErrRequestFailed) Error

func (err *ErrRequestFailed) Error() string

Error satisfies the error interface.

func (*ErrRequestFailed) Unwrap

func (err *ErrRequestFailed) Unwrap() error

Unwrap satisfies the error chain interface.

type Error

type Error string

Error is a transrpc error.

const (
	// ErrInvalidTorrentHash is the invalid torrent hash error.
	ErrInvalidTorrentHash Error = "invalid torrent hash"

	// ErrInvalidIdentifierType is the invalid identifier type error.
	ErrInvalidIdentifierType Error = "invalid identifier type"

	// ErrUnauthorizedUser is the unauthorized user error.
	ErrUnauthorizedUser Error = "unauthorized user"

	// ErrUnknownProblemEncountered is the unknown problem encountered error.
	ErrUnknownProblemEncountered Error = "unknown problem encountered"

	// ErrRecentlyActiveCanHaveOnlyOneValue is the recently-active can have only one value error.
	ErrRecentlyActiveCanHaveOnlyOneValue Error = "recently-active can have only one value"

	// ErrInvalidPriority is the invalid priority error.
	ErrInvalidPriority Error = "invalid priority"

	// ErrInvalidStatus is the invalid status error.
	ErrInvalidStatus Error = "invalid status"

	// ErrInvalidMode is the invalid mode error.
	ErrInvalidMode Error = "invalid mode"

	// ErrInvalidState is the invalid state error.
	ErrInvalidState Error = "invalid state"

	// ErrInvalidTime is the invalid time error.
	ErrInvalidTime Error = "invalid time"

	// ErrInvalidDuration is the invalid duration error.
	ErrInvalidDuration Error = "invalid duration"

	// ErrInvalidBool is the invalid bool error.
	ErrInvalidBool Error = "invalid bool"

	// ErrInvalidEncryption is the invalid encryption error.
	ErrInvalidEncryption Error = "invalid encryption"

	// ErrTorrentRenamePathCanOnlyBeUsedWithOneTorrentIdentifier is the torrent
	// rename path can only be used with one torrent identifier error.
	ErrTorrentRenamePathCanOnlyBeUsedWithOneTorrentIdentifier Error = "torrent rename path can only be used with one torrent identifier"
)

Error values.

func (Error) Error

func (err Error) Error() string

Error satisfies the error interface.

type FreeSpaceRequest

type FreeSpaceRequest struct {
	Path string `json:"path,omitempty" yaml:"path,omitempty"`
}

FreeSpaceRequest is the free space request.

func FreeSpace

func FreeSpace(path string) *FreeSpaceRequest

FreeSpace creates a free space request.

func (*FreeSpaceRequest) Do

func (req *FreeSpaceRequest) Do(ctx context.Context, cl *Client) (ByteCount, error)

Do executes the free space request against the provided context and client.

type Limit

type Limit int64

Limit is a K bytes per second limit.

func (Limit) Add

func (l Limit) Add(i interface{}) interface{}

Add adds i to the byte count.

func (Limit) Format

func (l Limit) Format(asIEC bool, prec int) string

Format formats the rate.

func (Limit) Int64

func (l Limit) Int64() int64

Int64 returns the rate as an int64.

func (Limit) String

func (l Limit) String() string

String satisfies the fmt.Stringer interface.

type Mode

type Mode int64

Mode are idle/ratio modes.

const (
	ModeGlobal Mode = iota
	ModeSingle
	ModeUnlimited
)

Modes.

func (Mode) String

func (i Mode) String() string

func (*Mode) UnmarshalJSON

func (m *Mode) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type Percent

type Percent float64

Percent wraps a float64.

func (Percent) String

func (p Percent) String() string

String satisfies the fmt.Stringer interface.

type PortTestRequest

type PortTestRequest struct{}

PortTestRequest is the port test request.

func PortTest

func PortTest() *PortTestRequest

PortTest creates a port test request.

func (*PortTestRequest) Do

func (req *PortTestRequest) Do(ctx context.Context, cl *Client) (bool, error)

Do executes the port test request against the provided context and client.

type Priority

type Priority int64

Priority are file priorities.

const (
	PriorityLow    Priority = -1
	PriorityNormal Priority = 0
	PriorityHigh   Priority = 1
)

Priorities.

func (Priority) String

func (i Priority) String() string

func (*Priority) UnmarshalJSON

func (p *Priority) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type QueueMoveBottomRequest

type QueueMoveBottomRequest = Request

QueueMoveBottomRequest is a queue move bottom request.

func QueueMoveBottom

func QueueMoveBottom(ids ...interface{}) *QueueMoveBottomRequest

QueueMoveBottom creates a queue move bottom request for the specified ids.

type QueueMoveDownRequest

type QueueMoveDownRequest = Request

QueueMoveDownRequest is a queue move down request.

func QueueMoveDown

func QueueMoveDown(ids ...interface{}) *QueueMoveDownRequest

QueueMoveDown creates a queue move down request for the specified ids.

type QueueMoveTopRequest

type QueueMoveTopRequest = Request

QueueMoveTopRequest is a queue move top request.

func QueueMoveTop

func QueueMoveTop(ids ...interface{}) *QueueMoveTopRequest

QueueMoveTop creates a queue move top request for the specified ids.

type QueueMoveUpRequest

type QueueMoveUpRequest = Request

QueueMoveUpRequest is a queue move up request.

func QueueMoveUp

func QueueMoveUp(ids ...interface{}) *QueueMoveUpRequest

QueueMoveUp creates a queue move up request for the specified ids.

type Rate

type Rate int64

Rate is a bytes per second rate.

func (Rate) Add

func (r Rate) Add(i interface{}) interface{}

Add adds i to the byte count.

func (Rate) Format

func (r Rate) Format(asIEC bool, prec int) string

Format formats the rate.

func (Rate) Int64

func (r Rate) Int64() int64

Int64 returns the rate as an int64.

func (Rate) String

func (r Rate) String() string

String satisfies the fmt.Stringer interface.

type Request

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

Request is a generic request used when working with a list of torrent identifiers.

func NewRequest

func NewRequest(method string, ids ...interface{}) *Request

NewRequest creates a generic request for a list of torrent identifiers and the named method.

Passed IDs can be any of type of int{,8,16,32,64}, [40]byte, []byte, or string.

Used for torrent-{start,start-now,stop,verify,reannounce} methods.

func (*Request) Do

func (req *Request) Do(ctx context.Context, cl *Client) error

Do executes the torrent request using the provided context and client.

type Session

type Session struct {
	AltSpeedDown              int64      `json:"alt-speed-down,omitempty" yaml:"alt-speed-down,omitempty"`                             // max global download speed (KBps)
	AltSpeedEnabled           bool       `json:"alt-speed-enabled,omitempty" yaml:"alt-speed-enabled,omitempty"`                       // true means use the alt speeds
	AltSpeedTimeBegin         int64      `json:"alt-speed-time-begin,omitempty" yaml:"alt-speed-time-begin,omitempty"`                 // when to turn on alt speeds (units: minutes after midnight)
	AltSpeedTimeEnabled       bool       `json:"alt-speed-time-enabled,omitempty" yaml:"alt-speed-time-enabled,omitempty"`             // true means the scheduled on/off times are used
	AltSpeedTimeEnd           int64      `json:"alt-speed-time-end,omitempty" yaml:"alt-speed-time-end,omitempty"`                     // when to turn off alt speeds (units: same)
	AltSpeedTimeDay           int64      `json:"alt-speed-time-day,omitempty" yaml:"alt-speed-time-day,omitempty"`                     // what day(s) to turn on alt speeds (look at tr_sched_day)
	AltSpeedUp                int64      `json:"alt-speed-up,omitempty" yaml:"alt-speed-up,omitempty"`                                 // max global upload speed (KBps)
	BlocklistURL              string     `json:"blocklist-url,omitempty" yaml:"blocklist-url,omitempty"`                               // location of the blocklist to use for "blocklist-update"
	BlocklistEnabled          bool       `json:"blocklist-enabled,omitempty" yaml:"blocklist-enabled,omitempty"`                       // true means enabled
	BlocklistSize             int64      `json:"blocklist-size,omitempty" yaml:"blocklist-size,omitempty"`                             // number of rules in the blocklist
	CacheSizeMb               int64      `json:"cache-size-mb,omitempty" yaml:"cache-size-mb,omitempty"`                               // maximum size of the disk cache (MB)
	ConfigDir                 string     `json:"config-dir,omitempty" yaml:"config-dir,omitempty"`                                     // location of transmission's configuration directory
	DownloadDir               string     `json:"download-dir,omitempty" yaml:"download-dir,omitempty"`                                 // default path to download torrents
	DownloadQueueSize         int64      `json:"download-queue-size,omitempty" yaml:"download-queue-size,omitempty"`                   // max number of torrents to download at once (see download-queue-enabled)
	DownloadQueueEnabled      bool       `json:"download-queue-enabled,omitempty" yaml:"download-queue-enabled,omitempty"`             // if true, limit how many torrents can be downloaded at once
	DownloadDirFreeSpace      int64      `json:"download-dir-free-space,omitempty" yaml:"download-dir-free-space,omitempty"`           // ---- not documented ----
	DhtEnabled                bool       `json:"dht-enabled,omitempty" yaml:"dht-enabled,omitempty"`                                   // true means allow dht in public torrents
	Encryption                Encryption `json:"encryption,omitempty" yaml:"encryption,omitempty"`                                     // "required", "preferred", "tolerated"
	IdleSeedingLimit          int64      `json:"idle-seeding-limit,omitempty" yaml:"idle-seeding-limit,omitempty"`                     // torrents we're seeding will be stopped if they're idle for this long
	IdleSeedingLimitEnabled   bool       `json:"idle-seeding-limit-enabled,omitempty" yaml:"idle-seeding-limit-enabled,omitempty"`     // true if the seeding inactivity limit is honored by default
	IncompleteDir             string     `json:"incomplete-dir,omitempty" yaml:"incomplete-dir,omitempty"`                             // path for incomplete torrents, when enabled
	IncompleteDirEnabled      bool       `json:"incomplete-dir-enabled,omitempty" yaml:"incomplete-dir-enabled,omitempty"`             // true means keep torrents in incomplete-dir until done
	LpdEnabled                bool       `json:"lpd-enabled,omitempty" yaml:"lpd-enabled,omitempty"`                                   // true means allow Local Peer Discovery in public torrents
	PeerLimitGlobal           int64      `json:"peer-limit-global,omitempty" yaml:"peer-limit-global,omitempty"`                       // maximum global number of peers
	PeerLimitPerTorrent       int64      `json:"peer-limit-per-torrent,omitempty" yaml:"peer-limit-per-torrent,omitempty"`             // maximum global number of peers
	PexEnabled                bool       `json:"pex-enabled,omitempty" yaml:"pex-enabled,omitempty"`                                   // true means allow pex in public torrents
	PeerPort                  int64      `json:"peer-port,omitempty" yaml:"peer-port,omitempty"`                                       // port number
	PeerPortRandomOnStart     bool       `json:"peer-port-random-on-start,omitempty" yaml:"peer-port-random-on-start,omitempty"`       // true means pick a random peer port on launch
	PortForwardingEnabled     bool       `json:"port-forwarding-enabled,omitempty" yaml:"port-forwarding-enabled,omitempty"`           // true means enabled
	QueueStalledEnabled       bool       `json:"queue-stalled-enabled,omitempty" yaml:"queue-stalled-enabled,omitempty"`               // whether or not to consider idle torrents as stalled
	QueueStalledMinutes       int64      `json:"queue-stalled-minutes,omitempty" yaml:"queue-stalled-minutes,omitempty"`               // torrents that are idle for N minutes aren't counted toward seed-queue-size or download-queue-size
	RenamePartialFiles        bool       `json:"rename-partial-files,omitempty" yaml:"rename-partial-files,omitempty"`                 // true means append ".part" to incomplete files
	RPCVersion                int64      `json:"rpc-version,omitempty" yaml:"rpc-version,omitempty"`                                   // the current RPC API version
	RPCVersionMinimum         int64      `json:"rpc-version-minimum,omitempty" yaml:"rpc-version-minimum,omitempty"`                   // the minimum RPC API version supported
	ScriptTorrentDoneFilename string     `json:"script-torrent-done-filename,omitempty" yaml:"script-torrent-done-filename,omitempty"` // filename of the script to run
	ScriptTorrentDoneEnabled  bool       `json:"script-torrent-done-enabled,omitempty" yaml:"script-torrent-done-enabled,omitempty"`   // whether or not to call the "done" script
	SeedRatioLimit            float64    `json:"seedRatioLimit,omitempty" yaml:"seedRatioLimit,omitempty"`                             // the default seed ratio for torrents to use
	SeedRatioLimited          bool       `json:"seedRatioLimited,omitempty" yaml:"seedRatioLimited,omitempty"`                         // true if seedRatioLimit is honored by default
	SeedQueueSize             int64      `json:"seed-queue-size,omitempty" yaml:"seed-queue-size,omitempty"`                           // max number of torrents to uploaded at once (see seed-queue-enabled)
	SeedQueueEnabled          bool       `json:"seed-queue-enabled,omitempty" yaml:"seed-queue-enabled,omitempty"`                     // if true, limit how many torrents can be uploaded at once
	SpeedLimitDown            int64      `json:"speed-limit-down,omitempty" yaml:"speed-limit-down,omitempty"`                         // max global download speed (KBps)
	SpeedLimitDownEnabled     bool       `json:"speed-limit-down-enabled,omitempty" yaml:"speed-limit-down-enabled,omitempty"`         // true means enabled
	SpeedLimitUp              int64      `json:"speed-limit-up,omitempty" yaml:"speed-limit-up,omitempty"`                             // max global upload speed (KBps)
	SpeedLimitUpEnabled       bool       `json:"speed-limit-up-enabled,omitempty" yaml:"speed-limit-up-enabled,omitempty"`             // true means enabled
	StartAddedTorrents        bool       `json:"start-added-torrents,omitempty" yaml:"start-added-torrents,omitempty"`                 // true means added torrents will be started right away
	TrashOriginalTorrentFiles bool       `json:"trash-original-torrent-files,omitempty" yaml:"trash-original-torrent-files,omitempty"` // true means the .torrent file of added torrents will be deleted
	Units                     Units      `json:"units,omitempty" yaml:"units,omitempty"`                                               // see units below
	UtpEnabled                bool       `json:"utp-enabled,omitempty" yaml:"utp-enabled,omitempty"`                                   // true means allow utp
	Version                   string     `json:"version,omitempty" yaml:"version,omitempty"`                                           // long version string "$version ($revision)"
	// contains filtered or unexported fields
}

Session holds transmission rpc session arguments.

type SessionCloseRequest

type SessionCloseRequest struct{}

SessionCloseRequest is the session close request.

func SessionClose

func SessionClose() *SessionCloseRequest

SessionClose creates a session close request.

func SessionShutdown

func SessionShutdown() *SessionCloseRequest

SessionShutdown creates a session close request.

Alias for SessionClose.

func (*SessionCloseRequest) Do

func (req *SessionCloseRequest) Do(ctx context.Context, cl *Client) error

Do executes the session close request against the provided context and client.

type SessionGetRequest

type SessionGetRequest struct{}

SessionGetRequest is the session get request.

func SessionGet

func SessionGet() *SessionGetRequest

SessionGet creates a session get request.

func (*SessionGetRequest) Do

Do executes the session get request against the provided context and client.

type SessionGetResponse

type SessionGetResponse = Session

SessionGetResponse is the session get response.

type SessionSetRequest

type SessionSetRequest Session

SessionSetRequest is the session set request.

func SessionSet

func SessionSet() *SessionSetRequest

SessionSet creates a session set request.

func (*SessionSetRequest) Do

func (req *SessionSetRequest) Do(ctx context.Context, cl *Client) error

Do executes a request for the session values against the provided context and client.

func (SessionSetRequest) WithAltSpeedDown

func (req SessionSetRequest) WithAltSpeedDown(altSpeedDown int64) *SessionSetRequest

WithAltSpeedDown sets max global download speed (KBps).

func (SessionSetRequest) WithAltSpeedEnabled

func (req SessionSetRequest) WithAltSpeedEnabled(altSpeedEnabled bool) *SessionSetRequest

WithAltSpeedEnabled sets true means use the alt speeds.

func (SessionSetRequest) WithAltSpeedTimeBegin

func (req SessionSetRequest) WithAltSpeedTimeBegin(altSpeedTimeBegin int64) *SessionSetRequest

WithAltSpeedTimeBegin sets when to turn on alt speeds (units: minutes after midnight).

func (SessionSetRequest) WithAltSpeedTimeDay

func (req SessionSetRequest) WithAltSpeedTimeDay(altSpeedTimeDay int64) *SessionSetRequest

WithAltSpeedTimeDay sets what day(s) to turn on alt speeds (look at tr_sched_day).

func (SessionSetRequest) WithAltSpeedTimeEnabled

func (req SessionSetRequest) WithAltSpeedTimeEnabled(altSpeedTimeEnabled bool) *SessionSetRequest

WithAltSpeedTimeEnabled sets true means the scheduled on/off times are used.

func (SessionSetRequest) WithAltSpeedTimeEnd

func (req SessionSetRequest) WithAltSpeedTimeEnd(altSpeedTimeEnd int64) *SessionSetRequest

WithAltSpeedTimeEnd sets when to turn off alt speeds (units: same).

func (SessionSetRequest) WithAltSpeedUp

func (req SessionSetRequest) WithAltSpeedUp(altSpeedUp int64) *SessionSetRequest

WithAltSpeedUp sets max global upload speed (KBps).

func (SessionSetRequest) WithBlocklistEnabled

func (req SessionSetRequest) WithBlocklistEnabled(blocklistEnabled bool) *SessionSetRequest

WithBlocklistEnabled sets true means enabled.

func (SessionSetRequest) WithBlocklistURL

func (req SessionSetRequest) WithBlocklistURL(blocklistURL string) *SessionSetRequest

WithBlocklistURL sets location of the blocklist to use for "blocklist-update".

func (SessionSetRequest) WithCacheSizeMb

func (req SessionSetRequest) WithCacheSizeMb(cacheSizeMb int64) *SessionSetRequest

WithCacheSizeMb sets maximum size of the disk cache (MB).

func (SessionSetRequest) WithChanged

func (req SessionSetRequest) WithChanged(fields ...string) *SessionSetRequest

WithChanged marks the fields that were changed.

func (SessionSetRequest) WithDhtEnabled

func (req SessionSetRequest) WithDhtEnabled(dhtEnabled bool) *SessionSetRequest

WithDhtEnabled sets true means allow dht in public torrents.

func (SessionSetRequest) WithDownloadDir

func (req SessionSetRequest) WithDownloadDir(downloadDir string) *SessionSetRequest

WithDownloadDir sets default path to download torrents.

func (SessionSetRequest) WithDownloadQueueEnabled

func (req SessionSetRequest) WithDownloadQueueEnabled(downloadQueueEnabled bool) *SessionSetRequest

WithDownloadQueueEnabled sets if true, limit how many torrents can be downloaded at once.

func (SessionSetRequest) WithDownloadQueueSize

func (req SessionSetRequest) WithDownloadQueueSize(downloadQueueSize int64) *SessionSetRequest

WithDownloadQueueSize sets max number of torrents to download at once (see download-queue-enabled).

func (SessionSetRequest) WithEncryption

func (req SessionSetRequest) WithEncryption(encryption Encryption) *SessionSetRequest

WithEncryption sets "required", "preferred", "tolerated".

func (SessionSetRequest) WithIdleSeedingLimit

func (req SessionSetRequest) WithIdleSeedingLimit(idleSeedingLimit int64) *SessionSetRequest

WithIdleSeedingLimit sets torrents we're seeding will be stopped if they're idle for this long.

func (SessionSetRequest) WithIdleSeedingLimitEnabled

func (req SessionSetRequest) WithIdleSeedingLimitEnabled(idleSeedingLimitEnabled bool) *SessionSetRequest

WithIdleSeedingLimitEnabled sets true if the seeding inactivity limit is honored by default.

func (SessionSetRequest) WithIncompleteDir

func (req SessionSetRequest) WithIncompleteDir(incompleteDir string) *SessionSetRequest

WithIncompleteDir sets path for incomplete torrents, when enabled.

func (SessionSetRequest) WithIncompleteDirEnabled

func (req SessionSetRequest) WithIncompleteDirEnabled(incompleteDirEnabled bool) *SessionSetRequest

WithIncompleteDirEnabled sets true means keep torrents in incomplete-dir until done.

func (SessionSetRequest) WithLpdEnabled

func (req SessionSetRequest) WithLpdEnabled(lpdEnabled bool) *SessionSetRequest

WithLpdEnabled sets true means allow Local Peer Discovery in public torrents.

func (SessionSetRequest) WithPeerLimitGlobal

func (req SessionSetRequest) WithPeerLimitGlobal(peerLimitGlobal int64) *SessionSetRequest

WithPeerLimitGlobal sets maximum global number of peers.

func (SessionSetRequest) WithPeerLimitPerTorrent

func (req SessionSetRequest) WithPeerLimitPerTorrent(peerLimitPerTorrent int64) *SessionSetRequest

WithPeerLimitPerTorrent sets maximum global number of peers.

func (SessionSetRequest) WithPeerPort

func (req SessionSetRequest) WithPeerPort(peerPort int64) *SessionSetRequest

WithPeerPort sets port number.

func (SessionSetRequest) WithPeerPortRandomOnStart

func (req SessionSetRequest) WithPeerPortRandomOnStart(peerPortRandomOnStart bool) *SessionSetRequest

WithPeerPortRandomOnStart sets true means pick a random peer port on launch.

func (SessionSetRequest) WithPexEnabled

func (req SessionSetRequest) WithPexEnabled(pexEnabled bool) *SessionSetRequest

WithPexEnabled sets true means allow pex in public torrents.

func (SessionSetRequest) WithPortForwardingEnabled

func (req SessionSetRequest) WithPortForwardingEnabled(portForwardingEnabled bool) *SessionSetRequest

WithPortForwardingEnabled sets true means enabled.

func (SessionSetRequest) WithQueueStalledEnabled

func (req SessionSetRequest) WithQueueStalledEnabled(queueStalledEnabled bool) *SessionSetRequest

WithQueueStalledEnabled sets whether or not to consider idle torrents as stalled.

func (SessionSetRequest) WithQueueStalledMinutes

func (req SessionSetRequest) WithQueueStalledMinutes(queueStalledMinutes int64) *SessionSetRequest

WithQueueStalledMinutes sets torrents that are idle for N minutes aren't counted toward seed-queue-size or download-queue-size.

func (SessionSetRequest) WithRenamePartialFiles

func (req SessionSetRequest) WithRenamePartialFiles(renamePartialFiles bool) *SessionSetRequest

WithRenamePartialFiles sets true means append ".part" to incomplete files.

func (SessionSetRequest) WithScriptTorrentDoneEnabled

func (req SessionSetRequest) WithScriptTorrentDoneEnabled(scriptTorrentDoneEnabled bool) *SessionSetRequest

WithScriptTorrentDoneEnabled sets whether or not to call the "done" script.

func (SessionSetRequest) WithScriptTorrentDoneFilename

func (req SessionSetRequest) WithScriptTorrentDoneFilename(scriptTorrentDoneFilename string) *SessionSetRequest

WithScriptTorrentDoneFilename sets filename of the script to run.

func (SessionSetRequest) WithSeedQueueEnabled

func (req SessionSetRequest) WithSeedQueueEnabled(seedQueueEnabled bool) *SessionSetRequest

WithSeedQueueEnabled sets if true, limit how many torrents can be uploaded at once.

func (SessionSetRequest) WithSeedQueueSize

func (req SessionSetRequest) WithSeedQueueSize(seedQueueSize int64) *SessionSetRequest

WithSeedQueueSize sets max number of torrents to uploaded at once (see seed-queue-enabled).

func (SessionSetRequest) WithSeedRatioLimit

func (req SessionSetRequest) WithSeedRatioLimit(seedRatioLimit float64) *SessionSetRequest

WithSeedRatioLimit sets the default seed ratio for torrents to use.

func (SessionSetRequest) WithSeedRatioLimited

func (req SessionSetRequest) WithSeedRatioLimited(seedRatioLimited bool) *SessionSetRequest

WithSeedRatioLimited sets true if seedRatioLimit is honored by default.

func (SessionSetRequest) WithSpeedLimitDown

func (req SessionSetRequest) WithSpeedLimitDown(speedLimitDown int64) *SessionSetRequest

WithSpeedLimitDown sets max global download speed (KBps).

func (SessionSetRequest) WithSpeedLimitDownEnabled

func (req SessionSetRequest) WithSpeedLimitDownEnabled(speedLimitDownEnabled bool) *SessionSetRequest

WithSpeedLimitDownEnabled sets true means enabled.

func (SessionSetRequest) WithSpeedLimitUp

func (req SessionSetRequest) WithSpeedLimitUp(speedLimitUp int64) *SessionSetRequest

WithSpeedLimitUp sets max global upload speed (KBps).

func (SessionSetRequest) WithSpeedLimitUpEnabled

func (req SessionSetRequest) WithSpeedLimitUpEnabled(speedLimitUpEnabled bool) *SessionSetRequest

WithSpeedLimitUpEnabled sets true means enabled.

func (SessionSetRequest) WithStartAddedTorrents

func (req SessionSetRequest) WithStartAddedTorrents(startAddedTorrents bool) *SessionSetRequest

WithStartAddedTorrents sets true means added torrents will be started right away.

func (SessionSetRequest) WithTrashOriginalTorrentFiles

func (req SessionSetRequest) WithTrashOriginalTorrentFiles(trashOriginalTorrentFiles bool) *SessionSetRequest

WithTrashOriginalTorrentFiles sets true means the .torrent file of added torrents will be deleted.

func (SessionSetRequest) WithUnits

func (req SessionSetRequest) WithUnits(units Units) *SessionSetRequest

WithUnits sets see units below.

func (SessionSetRequest) WithUtpEnabled

func (req SessionSetRequest) WithUtpEnabled(utpEnabled bool) *SessionSetRequest

WithUtpEnabled sets true means allow utp.

type SessionStatsRequest

type SessionStatsRequest struct{}

SessionStatsRequest is the session stats request.

func SessionStats

func SessionStats() *SessionStatsRequest

SessionStats creates a session stats request.

func (*SessionStatsRequest) Do

Do executes the session stats request against the provided context and client.

type SessionStatsResponse

type SessionStatsResponse struct {
	ActiveTorrentCount int64 `json:"activeTorrentCount,omitempty" yaml:"activeTorrentCount,omitempty"`
	DownloadSpeed      Rate  `json:"downloadSpeed,omitempty" yaml:"downloadSpeed,omitempty"`
	PausedTorrentCount int64 `json:"pausedTorrentCount,omitempty" yaml:"pausedTorrentCount,omitempty"`
	TorrentCount       int64 `json:"torrentCount,omitempty" yaml:"torrentCount,omitempty"`
	UploadSpeed        Rate  `json:"uploadSpeed,omitempty" yaml:"uploadSpeed,omitempty"`
	CumulativeStats    struct {
		UploadedBytes   ByteCount `json:"uploadedBytes,omitempty" yaml:"uploadedBytes,omitempty"`     // tr_session_stats
		DownloadedBytes ByteCount `json:"downloadedBytes,omitempty" yaml:"downloadedBytes,omitempty"` // tr_session_stats
		FilesAdded      int64     `json:"filesAdded,omitempty" yaml:"filesAdded,omitempty"`           // tr_session_stats
		SessionCount    int64     `json:"sessionCount,omitempty" yaml:"sessionCount,omitempty"`       // tr_session_stats
		SecondsActive   Duration  `json:"secondsActive,omitempty" yaml:"secondsActive,omitempty"`     // tr_session_stats
	} `json:"cumulative-stats,omitempty" yaml:"cumulative-stats,omitempty"`
	CurrentStats struct {
		UploadedBytes   ByteCount `json:"uploadedBytes,omitempty" yaml:"uploadedBytes,omitempty"`     // tr_session_stats
		DownloadedBytes ByteCount `json:"downloadedBytes,omitempty" yaml:"downloadedBytes,omitempty"` // tr_session_stats
		FilesAdded      int64     `json:"filesAdded,omitempty" yaml:"filesAdded,omitempty"`           // tr_session_stats
		SessionCount    int64     `json:"sessionCount,omitempty" yaml:"sessionCount,omitempty"`       // tr_session_stats
		SecondsActive   Duration  `json:"secondsActive,omitempty" yaml:"secondsActive,omitempty"`     // tr_session_stats
	} `json:"current-stats,omitempty" yaml:"current-stats,omitempty"`
}

SessionStatsResponse is the session stats response.

type State

type State int64

State are tracker states.

const (
	StateInactive State = iota
	StateWaiting
	StateQueued
	StateActive
)

States.

func (State) String

func (i State) String() string

func (*State) UnmarshalJSON

func (s *State) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type Status

type Status int64

Status are torrent statuses.

const (
	StatusStopped Status = iota
	StatusCheckWait
	StatusChecking
	StatusDownloadWait
	StatusDownloading
	StatusSeedWait
	StatusSeeding
)

Statuses.

func (Status) String

func (i Status) String() string

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type Time

type Time time.Time

Time wraps time.Time.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface.

func (Time) MarshalYAML

func (t Time) MarshalYAML() (interface{}, error)

MarshalYAML satisfies the yaml.Marshaler interface.

func (Time) String

func (t Time) String() string

String satisfies the fmt.Stringer interface.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

type Torrent

type Torrent struct {
	ActivityDate      Time      `json:"activityDate,omitempty" yaml:"activityDate,omitempty"`           // tr_stat
	AddedDate         Time      `json:"addedDate,omitempty" yaml:"addedDate,omitempty"`                 // tr_stat
	BandwidthPriority Priority  `json:"bandwidthPriority,omitempty" yaml:"bandwidthPriority,omitempty"` // tr_priority_t
	Comment           string    `json:"comment,omitempty" yaml:"comment,omitempty"`                     // tr_info
	CorruptEver       ByteCount `json:"corruptEver,omitempty" yaml:"corruptEver,omitempty"`             // tr_stat
	Creator           string    `json:"creator,omitempty" yaml:"creator,omitempty"`                     // tr_info
	DateCreated       Time      `json:"dateCreated,omitempty" yaml:"dateCreated,omitempty"`             // tr_info
	DesiredAvailable  ByteCount `json:"desiredAvailable,omitempty" yaml:"desiredAvailable,omitempty"`   // tr_stat
	DoneDate          Time      `json:"doneDate,omitempty" yaml:"doneDate,omitempty"`                   // tr_stat
	DownloadDir       string    `json:"downloadDir,omitempty" yaml:"downloadDir,omitempty"`             // tr_torrent
	DownloadedEver    ByteCount `json:"downloadedEver,omitempty" yaml:"downloadedEver,omitempty"`       // tr_stat
	DownloadLimit     Limit     `json:"downloadLimit,omitempty" yaml:"downloadLimit,omitempty"`         // tr_torrent
	DownloadLimited   bool      `json:"downloadLimited,omitempty" yaml:"downloadLimited,omitempty"`     // tr_torrent
	Error             ErrNo     `json:"error,omitempty" yaml:"error,omitempty"`                         // tr_stat
	ErrorString       string    `json:"errorString,omitempty" yaml:"errorString,omitempty"`             // tr_stat
	Eta               Duration  `json:"eta,omitempty" yaml:"eta,omitempty"`                             // tr_stat
	EtaIdle           Duration  `json:"etaIdle,omitempty" yaml:"etaIdle,omitempty"`                     // tr_stat
	Files             []struct {
		BytesCompleted ByteCount `json:"bytesCompleted,omitempty" yaml:"bytesCompleted,omitempty"` // tr_torrent
		Length         ByteCount `json:"length,omitempty" yaml:"length,omitempty"`                 // tr_info
		Name           string    `json:"name,omitempty" yaml:"name,omitempty"`                     // tr_info
	} `json:"files,omitempty" yaml:"files,omitempty"` // n/a
	FileStats []struct {
		BytesCompleted ByteCount `json:"bytesCompleted,omitempty" yaml:"bytesCompleted,omitempty"` // tr_torrent
		Wanted         bool      `json:"wanted,omitempty" yaml:"wanted,omitempty"`                 // tr_info
		Priority       Priority  `json:"priority,omitempty" yaml:"priority,omitempty"`             // tr_info
	} `json:"fileStats,omitempty" yaml:"fileStats,omitempty"` // n/a
	HashString              string    `json:"hashString,omitempty" yaml:"hashString,omitempty"`                           // tr_info
	HaveUnchecked           ByteCount `json:"haveUnchecked,omitempty" yaml:"haveUnchecked,omitempty"`                     // tr_stat
	HaveValid               ByteCount `json:"haveValid,omitempty" yaml:"haveValid,omitempty"`                             // tr_stat
	HonorsSessionLimits     bool      `json:"honorsSessionLimits,omitempty" yaml:"honorsSessionLimits,omitempty"`         // tr_torrent
	ID                      int64     `json:"id,omitempty" yaml:"id,omitempty"`                                           // tr_torrent
	IsFinished              bool      `json:"isFinished,omitempty" yaml:"isFinished,omitempty"`                           // tr_stat
	IsPrivate               bool      `json:"isPrivate,omitempty" yaml:"isPrivate,omitempty"`                             // tr_torrent
	IsStalled               bool      `json:"isStalled,omitempty" yaml:"isStalled,omitempty"`                             // tr_stat
	Labels                  []string  `json:"labels,omitempty" yaml:"labels,omitempty"`                                   // tr_torrent
	LeftUntilDone           ByteCount `json:"leftUntilDone,omitempty" yaml:"leftUntilDone,omitempty"`                     // tr_stat
	MagnetLink              string    `json:"magnetLink,omitempty" yaml:"magnetLink,omitempty"`                           // n/a
	ManualAnnounceTime      Time      `json:"manualAnnounceTime,omitempty" yaml:"manualAnnounceTime,omitempty"`           // tr_stat
	MaxConnectedPeers       int64     `json:"maxConnectedPeers,omitempty" yaml:"maxConnectedPeers,omitempty"`             // tr_torrent
	MetadataPercentComplete Percent   `json:"metadataPercentComplete,omitempty" yaml:"metadataPercentComplete,omitempty"` // tr_stat
	Name                    string    `json:"name,omitempty" yaml:"name,omitempty"`                                       // tr_info
	PeerLimit               int64     `json:"peer-limit,omitempty" yaml:"peer-limit,omitempty"`                           // tr_torrent
	Peers                   []struct {
		Address            string  `json:"address,omitempty" yaml:"address,omitempty"`                       // tr_peer_stat
		ClientName         string  `json:"clientName,omitempty" yaml:"clientName,omitempty"`                 // tr_peer_stat
		ClientIsChoked     bool    `json:"clientIsChoked,omitempty" yaml:"clientIsChoked,omitempty"`         // tr_peer_stat
		ClientIsInterested bool    `json:"clientIsInterested,omitempty" yaml:"clientIsInterested,omitempty"` // tr_peer_stat
		FlagStr            string  `json:"flagStr,omitempty" yaml:"flagStr,omitempty"`                       // tr_peer_stat
		IsDownloadingFrom  bool    `json:"isDownloadingFrom,omitempty" yaml:"isDownloadingFrom,omitempty"`   // tr_peer_stat
		IsEncrypted        bool    `json:"isEncrypted,omitempty" yaml:"isEncrypted,omitempty"`               // tr_peer_stat
		IsIncoming         bool    `json:"isIncoming,omitempty" yaml:"isIncoming,omitempty"`                 // tr_peer_stat
		IsUploadingTo      bool    `json:"isUploadingTo,omitempty" yaml:"isUploadingTo,omitempty"`           // tr_peer_stat
		IsUTP              bool    `json:"isUTP,omitempty" yaml:"isUTP,omitempty"`                           // tr_peer_stat
		PeerIsChoked       bool    `json:"peerIsChoked,omitempty" yaml:"peerIsChoked,omitempty"`             // tr_peer_stat
		PeerIsInterested   bool    `json:"peerIsInterested,omitempty" yaml:"peerIsInterested,omitempty"`     // tr_peer_stat
		Port               int64   `json:"port,omitempty" yaml:"port,omitempty"`                             // tr_peer_stat
		Progress           Percent `json:"progress,omitempty" yaml:"progress,omitempty"`                     // tr_peer_stat
		RateToClient       Rate    `json:"rateToClient,omitempty" yaml:"rateToClient,omitempty"`             // tr_peer_stat
		RateToPeer         Rate    `json:"rateToPeer,omitempty" yaml:"rateToPeer,omitempty"`                 // tr_peer_stat
	} `json:"peers,omitempty" yaml:"peers,omitempty"` // n/a
	PeersConnected int64 `json:"peersConnected,omitempty" yaml:"peersConnected,omitempty"` // tr_stat
	PeersFrom      struct {
		FromCache    int64 `json:"fromCache,omitempty" yaml:"fromCache,omitempty"`       // tr_stat
		FromDht      int64 `json:"fromDht,omitempty" yaml:"fromDht,omitempty"`           // tr_stat
		FromIncoming int64 `json:"fromIncoming,omitempty" yaml:"fromIncoming,omitempty"` // tr_stat
		FromLpd      int64 `json:"fromLpd,omitempty" yaml:"fromLpd,omitempty"`           // tr_stat
		FromLtep     int64 `json:"fromLtep,omitempty" yaml:"fromLtep,omitempty"`         // tr_stat
		FromPex      int64 `json:"fromPex,omitempty" yaml:"fromPex,omitempty"`           // tr_stat
		FromTracker  int64 `json:"fromTracker,omitempty" yaml:"fromTracker,omitempty"`   // tr_stat
	} `json:"peersFrom,omitempty" yaml:"peersFrom,omitempty"` // n/a
	PeersGettingFromUs int64      `json:"peersGettingFromUs,omitempty" yaml:"peersGettingFromUs,omitempty"` // tr_stat
	PeersSendingToUs   int64      `json:"peersSendingToUs,omitempty" yaml:"peersSendingToUs,omitempty"`     // tr_stat
	PercentDone        Percent    `json:"percentDone,omitempty" yaml:"percentDone,omitempty"`               // tr_stat
	Pieces             []byte     `json:"pieces,omitempty" yaml:"pieces,omitempty"`                         // tr_torrent
	PieceCount         int64      `json:"pieceCount,omitempty" yaml:"pieceCount,omitempty"`                 // tr_info
	PieceSize          ByteCount  `json:"pieceSize,omitempty" yaml:"pieceSize,omitempty"`                   // tr_info
	Priorities         []Priority `json:"priorities,omitempty" yaml:"priorities,omitempty"`                 // n/a
	QueuePosition      int64      `json:"queuePosition,omitempty" yaml:"queuePosition,omitempty"`           // tr_stat
	RateDownload       Rate       `json:"rateDownload,omitempty" yaml:"rateDownload,omitempty"`             // tr_stat
	RateUpload         Rate       `json:"rateUpload,omitempty" yaml:"rateUpload,omitempty"`                 // tr_stat
	RecheckProgress    Percent    `json:"recheckProgress,omitempty" yaml:"recheckProgress,omitempty"`       // tr_stat
	SecondsDownloading Duration   `json:"secondsDownloading,omitempty" yaml:"secondsDownloading,omitempty"` // tr_stat
	SecondsSeeding     Duration   `json:"secondsSeeding,omitempty" yaml:"secondsSeeding,omitempty"`         // tr_stat
	SeedIdleLimit      int64      `json:"seedIdleLimit,omitempty" yaml:"seedIdleLimit,omitempty"`           // tr_torrent
	SeedIdleMode       Mode       `json:"seedIdleMode,omitempty" yaml:"seedIdleMode,omitempty"`             // tr_inactvelimit
	SeedRatioLimit     float64    `json:"seedRatioLimit,omitempty" yaml:"seedRatioLimit,omitempty"`         // tr_torrent
	SeedRatioMode      Mode       `json:"seedRatioMode,omitempty" yaml:"seedRatioMode,omitempty"`           // tr_ratiolimit
	SizeWhenDone       ByteCount  `json:"sizeWhenDone,omitempty" yaml:"sizeWhenDone,omitempty"`             // tr_stat
	StartDate          Time       `json:"startDate,omitempty" yaml:"startDate,omitempty"`                   // tr_stat
	Status             Status     `json:"status,omitempty" yaml:"status,omitempty"`                         // tr_stat
	Trackers           []struct {
		Announce string `json:"announce,omitempty" yaml:"announce,omitempty"` // tr_tracker_info
		ID       int64  `json:"id,omitempty" yaml:"id,omitempty"`             // tr_tracker_info
		Scrape   string `json:"scrape,omitempty" yaml:"scrape,omitempty"`     // tr_tracker_info
		Tier     int64  `json:"tier,omitempty" yaml:"tier,omitempty"`         // tr_tracker_info
	} `json:"trackers,omitempty" yaml:"trackers,omitempty"` // n/a
	TrackerStats []struct {
		Announce              string `json:"announce,omitempty" yaml:"announce,omitempty"`                           // tr_tracker_stat
		AnnounceState         State  `json:"announceState,omitempty" yaml:"announceState,omitempty"`                 // tr_tracker_stat
		DownloadCount         int64  `json:"downloadCount,omitempty" yaml:"downloadCount,omitempty"`                 // tr_tracker_stat
		HasAnnounced          bool   `json:"hasAnnounced,omitempty" yaml:"hasAnnounced,omitempty"`                   // tr_tracker_stat
		HasScraped            bool   `json:"hasScraped,omitempty" yaml:"hasScraped,omitempty"`                       // tr_tracker_stat
		Host                  string `json:"host,omitempty" yaml:"host,omitempty"`                                   // tr_tracker_stat
		ID                    int64  `json:"id,omitempty" yaml:"id,omitempty"`                                       // tr_tracker_stat
		IsBackup              bool   `json:"isBackup,omitempty" yaml:"isBackup,omitempty"`                           // tr_tracker_stat
		LastAnnouncePeerCount int64  `json:"lastAnnouncePeerCount,omitempty" yaml:"lastAnnouncePeerCount,omitempty"` // tr_tracker_stat
		LastAnnounceResult    string `json:"lastAnnounceResult,omitempty" yaml:"lastAnnounceResult,omitempty"`       // tr_tracker_stat
		LastAnnounceStartTime Time   `json:"lastAnnounceStartTime,omitempty" yaml:"lastAnnounceStartTime,omitempty"` // tr_tracker_stat
		LastAnnounceSucceeded bool   `json:"lastAnnounceSucceeded,omitempty" yaml:"lastAnnounceSucceeded,omitempty"` // tr_tracker_stat
		LastAnnounceTime      Time   `json:"lastAnnounceTime,omitempty" yaml:"lastAnnounceTime,omitempty"`           // tr_tracker_stat
		LastAnnounceTimedOut  bool   `json:"lastAnnounceTimedOut,omitempty" yaml:"lastAnnounceTimedOut,omitempty"`   // tr_tracker_stat
		LastScrapeResult      string `json:"lastScrapeResult,omitempty" yaml:"lastScrapeResult,omitempty"`           // tr_tracker_stat
		LastScrapeStartTime   Time   `json:"lastScrapeStartTime,omitempty" yaml:"lastScrapeStartTime,omitempty"`     // tr_tracker_stat
		LastScrapeSucceeded   bool   `json:"lastScrapeSucceeded,omitempty" yaml:"lastScrapeSucceeded,omitempty"`     // tr_tracker_stat
		LastScrapeTime        Time   `json:"lastScrapeTime,omitempty" yaml:"lastScrapeTime,omitempty"`               // tr_tracker_stat
		LastScrapeTimedOut    int64  `json:"lastScrapeTimedOut,omitempty" yaml:"lastScrapeTimedOut,omitempty"`       // tr_tracker_stat
		LeecherCount          int64  `json:"leecherCount,omitempty" yaml:"leecherCount,omitempty"`                   // tr_tracker_stat
		NextAnnounceTime      Time   `json:"nextAnnounceTime,omitempty" yaml:"nextAnnounceTime,omitempty"`           // tr_tracker_stat
		NextScrapeTime        Time   `json:"nextScrapeTime,omitempty" yaml:"nextScrapeTime,omitempty"`               // tr_tracker_stat
		Scrape                string `json:"scrape,omitempty" yaml:"scrape,omitempty"`                               // tr_tracker_stat
		ScrapeState           State  `json:"scrapeState,omitempty" yaml:"scrapeState,omitempty"`                     // tr_tracker_stat
		SeederCount           int64  `json:"seederCount,omitempty" yaml:"seederCount,omitempty"`                     // tr_tracker_stat
		Tier                  int64  `json:"tier,omitempty" yaml:"tier,omitempty"`                                   // tr_tracker_stat
	} `json:"trackerStats,omitempty" yaml:"trackerStats,omitempty"` // n/a
	TotalSize           ByteCount `json:"totalSize,omitempty" yaml:"totalSize,omitempty"`                     // tr_info
	TorrentFile         string    `json:"torrentFile,omitempty" yaml:"torrentFile,omitempty"`                 // tr_info
	UploadedEver        ByteCount `json:"uploadedEver,omitempty" yaml:"uploadedEver,omitempty"`               // tr_stat
	UploadLimit         Limit     `json:"uploadLimit,omitempty" yaml:"uploadLimit,omitempty"`                 // tr_torrent
	UploadLimited       bool      `json:"uploadLimited,omitempty" yaml:"uploadLimited,omitempty"`             // tr_torrent
	UploadRatio         float64   `json:"uploadRatio,omitempty" yaml:"uploadRatio,omitempty"`                 // tr_stat
	Wanted              []Bool    `json:"wanted,omitempty" yaml:"wanted,omitempty"`                           // n/a
	Webseeds            []string  `json:"webseeds,omitempty" yaml:"webseeds,omitempty"`                       // n/a
	WebseedsSendingToUs int64     `json:"webseedsSendingToUs,omitempty" yaml:"webseedsSendingToUs,omitempty"` // tr_stat
}

Torrent holds information about a torrent.

func (Torrent) ShortHash

func (t Torrent) ShortHash() string

ShortHash returns the short hash of the torrent.

type TorrentAddRequest

type TorrentAddRequest struct {
	Cookies           string  `json:"cookies,omitempty" yaml:"cookies,omitempty"`                     // pointer to a string of one or more cookies.
	DownloadDir       string  `json:"download-dir,omitempty" yaml:"download-dir,omitempty"`           // path to download the torrent to
	Filename          string  `json:"filename,omitempty" yaml:"filename,omitempty"`                   // filename or URL of the .torrent file
	Metainfo          []byte  `json:"metainfo,omitempty" yaml:"metainfo,omitempty"`                   // base64-encoded .torrent content
	Paused            bool    `json:"paused,omitempty" yaml:"paused,omitempty"`                       // if true, don't start the torrent
	PeerLimit         int64   `json:"peer-limit,omitempty" yaml:"peer-limit,omitempty"`               // maximum int64 of peers
	BandwidthPriority int64   `json:"bandwidthPriority,omitempty" yaml:"bandwidthPriority,omitempty"` // torrent's bandwidth tr_priority_t
	FilesWanted       []int64 `json:"files-wanted,omitempty" yaml:"files-wanted,omitempty"`           // indices of file(s) to download
	FilesUnwanted     []int64 `json:"files-unwanted,omitempty" yaml:"files-unwanted,omitempty"`       // indices of file(s) to not download
	PriorityHigh      []int64 `json:"priority-high,omitempty" yaml:"priority-high,omitempty"`         // indices of high-priority file(s)
	PriorityLow       []int64 `json:"priority-low,omitempty" yaml:"priority-low,omitempty"`           // indices of low-priority file(s)
	PriorityNormal    []int64 `json:"priority-normal,omitempty" yaml:"priority-normal,omitempty"`     // indices of normal-priority file(s)
}

TorrentAddRequest is the torrent add request.

func TorrentAdd

func TorrentAdd() *TorrentAddRequest

TorrentAdd creates a torrent add request.

func (*TorrentAddRequest) Do

Do executes the torrent add request against the provided context and client.

func (TorrentAddRequest) WithBandwidthPriority

func (req TorrentAddRequest) WithBandwidthPriority(bandwidthPriority int64) *TorrentAddRequest

WithBandwidthPriority sets torrent's bandwidth tr_priority_t.

func (TorrentAddRequest) WithCookies

func (req TorrentAddRequest) WithCookies(cookies string) *TorrentAddRequest

WithCookies sets cookies to a string of one or more cookies

func (TorrentAddRequest) WithCookiesList

func (req TorrentAddRequest) WithCookiesList(cookies ...string) *TorrentAddRequest

WithCookiesList sets cookies to the set of key, value strings.

func (TorrentAddRequest) WithCookiesMap

func (req TorrentAddRequest) WithCookiesMap(cookies map[string]string) *TorrentAddRequest

WithCookiesMap sets cookies from a map.

func (TorrentAddRequest) WithDownloadDir

func (req TorrentAddRequest) WithDownloadDir(downloadDir string) *TorrentAddRequest

WithDownloadDir sets path to download the torrent to.

func (TorrentAddRequest) WithFilename

func (req TorrentAddRequest) WithFilename(filename string) *TorrentAddRequest

WithFilename sets filename or URL of the .torrent file.

func (TorrentAddRequest) WithFilesUnwanted

func (req TorrentAddRequest) WithFilesUnwanted(filesUnwanted []int64) *TorrentAddRequest

WithFilesUnwanted sets indices of file(s) to not download.

func (TorrentAddRequest) WithFilesWanted

func (req TorrentAddRequest) WithFilesWanted(filesWanted []int64) *TorrentAddRequest

WithFilesWanted sets indices of file(s) to download.

func (TorrentAddRequest) WithMetainfo

func (req TorrentAddRequest) WithMetainfo(metainfo []byte) *TorrentAddRequest

WithMetainfo sets base64-encoded .torrent content.

func (TorrentAddRequest) WithPaused

func (req TorrentAddRequest) WithPaused(paused bool) *TorrentAddRequest

WithPaused sets if true, don't start the torrent.

func (TorrentAddRequest) WithPeerLimit

func (req TorrentAddRequest) WithPeerLimit(peerLimit int64) *TorrentAddRequest

WithPeerLimit sets maximum int64 of peers.

func (TorrentAddRequest) WithPriorityHigh

func (req TorrentAddRequest) WithPriorityHigh(priorityHigh []int64) *TorrentAddRequest

WithPriorityHigh sets indices of high-priority file(s).

func (TorrentAddRequest) WithPriorityLow

func (req TorrentAddRequest) WithPriorityLow(priorityLow []int64) *TorrentAddRequest

WithPriorityLow sets indices of low-priority file(s).

func (TorrentAddRequest) WithPriorityNormal

func (req TorrentAddRequest) WithPriorityNormal(priorityNormal []int64) *TorrentAddRequest

WithPriorityNormal sets indices of normal-priority file(s).

type TorrentAddResponse

type TorrentAddResponse struct {
	TorrentAdded     *Torrent `json:"torrent-added" yaml:"torrent-added"`
	TorrentDuplicate *Torrent `json:"torrent-duplicate" yaml:"torrent-duplicate"`
}

TorrentAddResponse is the torrent add response.

type TorrentGetRequest

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

TorrentGetRequest is the torrent get request.

func TorrentGet

func TorrentGet(ids ...interface{}) *TorrentGetRequest

TorrentGet creates a torrent get request for the specified torrent ids.

func (*TorrentGetRequest) Do

Do executes the torrent get request against the provided context and client.

func (TorrentGetRequest) WithFields

func (req TorrentGetRequest) WithFields(fields ...string) *TorrentGetRequest

WithFields indicates the fields for the host to return.

type TorrentGetResponse

type TorrentGetResponse struct {
	Torrents []Torrent     `json:"torrents,omitempty" yaml:"torrents,omitempty"` // contains the key/value pairs matching the request's "fields" argument
	Removed  []interface{} `json:"removed,omitempty" yaml:"removed,omitempty"`   // populated when the requested id was "recently-active"
}

TorrentGetResponse is the torrent get response.

type TorrentReannounceRequest

type TorrentReannounceRequest = Request

TorrentReannounceRequest is a torrent reannounce request.

func TorrentReannounce

func TorrentReannounce(ids ...interface{}) *TorrentReannounceRequest

TorrentReannounce creates a torrent reannounce request for the specified ids.

type TorrentRemoveRequest

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

TorrentRemoveRequest is the torrent remove request.

func TorrentRemove

func TorrentRemove(deleteLocalData bool, ids ...interface{}) *TorrentRemoveRequest

TorrentRemove creates a torrent remove request.

func (*TorrentRemoveRequest) Do

func (req *TorrentRemoveRequest) Do(ctx context.Context, cl *Client) error

Do executes the torrent remove request against the provided context and client.

func (TorrentRemoveRequest) WithDeleteLocalData

func (req TorrentRemoveRequest) WithDeleteLocalData(deleteLocalData bool) *TorrentRemoveRequest

WithDeleteLocalData sets delete local data. (default: false).

type TorrentRenamePathRequest

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

TorrentRenamePathRequest is the torrent rename path request.

func TorrentRenamePath

func TorrentRenamePath(path, name string, ids ...interface{}) *TorrentRenamePathRequest

TorrentRenamePath creates a torrent rename path request.

func (*TorrentRenamePathRequest) Do

Do executes the torrent rename path request against the provided context and client.

type TorrentSetLocationRequest

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

TorrentSetLocationRequest is the torrent set location request.

func TorrentSetLocation

func TorrentSetLocation(location string, move bool, ids ...interface{}) *TorrentSetLocationRequest

TorrentSetLocation creates a torrent set location request.

func (*TorrentSetLocationRequest) Do

Do executes the torrent set location request against the provided context and client.

type TorrentSetRequest

type TorrentSetRequest struct {
	BandwidthPriority   Priority      `json:"bandwidthPriority,omitempty" yaml:"bandwidthPriority,omitempty"`     // this torrent's bandwidth tr_priority_t
	DownloadLimit       int64         `json:"downloadLimit,omitempty" yaml:"downloadLimit,omitempty"`             // maximum download speed (KBps)
	DownloadLimited     bool          `json:"downloadLimited,omitempty" yaml:"downloadLimited,omitempty"`         // true if downloadLimit is honored
	FilesWanted         []int64       `json:"files-wanted,omitempty" yaml:"files-wanted,omitempty"`               // indices of file(s) to download
	FilesUnwanted       []int64       `json:"files-unwanted,omitempty" yaml:"files-unwanted,omitempty"`           // indices of file(s) to not download
	HonorsSessionLimits bool          `json:"honorsSessionLimits,omitempty" yaml:"honorsSessionLimits,omitempty"` // true if session upload limits are honored
	IDs                 []interface{} `json:"ids,omitempty" yaml:"ids,omitempty"`                                 // torrent list, as described in 3.1
	Labels              []string      `json:"labels,omitempty" yaml:"labels,omitempty"`                           // array of string labels
	Location            string        `json:"location,omitempty" yaml:"location,omitempty"`                       // new location of the torrent's content
	PeerLimit           int64         `json:"peer-limit,omitempty" yaml:"peer-limit,omitempty"`                   // maximum int64 of peers
	PriorityHigh        []int64       `json:"priority-high,omitempty" yaml:"priority-high,omitempty"`             // indices of high-priority file(s)
	PriorityLow         []int64       `json:"priority-low,omitempty" yaml:"priority-low,omitempty"`               // indices of low-priority file(s)
	PriorityNormal      []int64       `json:"priority-normal,omitempty" yaml:"priority-normal,omitempty"`         // indices of normal-priority file(s)
	QueuePosition       int64         `json:"queuePosition,omitempty" yaml:"queuePosition,omitempty"`             // position of this torrent in its queue [0...n)
	SeedIdleLimit       int64         `json:"seedIdleLimit,omitempty" yaml:"seedIdleLimit,omitempty"`             // torrent-level int64 of minutes of seeding inactivity
	SeedIdleMode        Mode          `json:"seedIdleMode,omitempty" yaml:"seedIdleMode,omitempty"`               // which seeding inactivity to use.  See tr_idlelimit
	SeedRatioLimit      float64       `json:"seedRatioLimit,omitempty" yaml:"seedRatioLimit,omitempty"`           // torrent-level seeding ratio
	SeedRatioMode       Mode          `json:"seedRatioMode,omitempty" yaml:"seedRatioMode,omitempty"`             // which ratio to use.  See tr_ratiolimit
	TrackerAdd          []string      `json:"trackerAdd,omitempty" yaml:"trackerAdd,omitempty"`                   // strings of announce URLs to add
	TrackerRemove       []int64       `json:"trackerRemove,omitempty" yaml:"trackerRemove,omitempty"`             // ids of trackers to remove
	TrackerReplace      []interface{} `json:"trackerReplace,omitempty" yaml:"trackerReplace,omitempty"`           // pairs of <trackerId/new announce URLs>
	UploadLimit         int64         `json:"uploadLimit,omitempty" yaml:"uploadLimit,omitempty"`                 // maximum upload speed (KBps)
	UploadLimited       bool          `json:"uploadLimited,omitempty" yaml:"uploadLimited,omitempty"`             // true if uploadLimit is honored
	// contains filtered or unexported fields
}

TorrentSetRequest is a torrent set request.

func TorrentSet

func TorrentSet(ids ...interface{}) *TorrentSetRequest

TorrentSet creates a torrent set request.

func (*TorrentSetRequest) Do

func (req *TorrentSetRequest) Do(ctx context.Context, cl *Client) error

Do executes the torrent set request using the provided context and client.

func (TorrentSetRequest) WithBandwidthPriority

func (req TorrentSetRequest) WithBandwidthPriority(bandwidthPriority Priority) *TorrentSetRequest

WithBandwidthPriority sets this torrent's bandwidth tr_priority_t.

func (TorrentSetRequest) WithChanged

func (req TorrentSetRequest) WithChanged(fields ...string) *TorrentSetRequest

WithChanged marks the fields that were changed.

func (TorrentSetRequest) WithDownloadLimit

func (req TorrentSetRequest) WithDownloadLimit(downloadLimit int64) *TorrentSetRequest

WithDownloadLimit sets maximum download speed (KBps).

func (TorrentSetRequest) WithDownloadLimited

func (req TorrentSetRequest) WithDownloadLimited(downloadLimited bool) *TorrentSetRequest

WithDownloadLimited sets true if downloadLimit is honored.

func (TorrentSetRequest) WithFilesUnwanted

func (req TorrentSetRequest) WithFilesUnwanted(filesUnwanted []int64) *TorrentSetRequest

WithFilesUnwanted sets indices of file(s) to not download.

func (TorrentSetRequest) WithFilesWanted

func (req TorrentSetRequest) WithFilesWanted(filesWanted []int64) *TorrentSetRequest

WithFilesWanted sets indices of file(s) to download.

func (TorrentSetRequest) WithHonorsSessionLimits

func (req TorrentSetRequest) WithHonorsSessionLimits(honorsSessionLimits bool) *TorrentSetRequest

WithHonorsSessionLimits sets true if session upload limits are honored.

func (TorrentSetRequest) WithIDs

func (req TorrentSetRequest) WithIDs(ids ...interface{}) *TorrentSetRequest

WithIDs sets torrent list, as described in 3.1.

func (TorrentSetRequest) WithLabels

func (req TorrentSetRequest) WithLabels(labels []string) *TorrentSetRequest

WithLabels sets array of string labels.

func (TorrentSetRequest) WithLocation

func (req TorrentSetRequest) WithLocation(location string) *TorrentSetRequest

WithLocation sets new location of the torrent's content.

func (TorrentSetRequest) WithPeerLimit

func (req TorrentSetRequest) WithPeerLimit(peerLimit int64) *TorrentSetRequest

WithPeerLimit sets maximum int64 of peers.

func (TorrentSetRequest) WithPriorityHigh

func (req TorrentSetRequest) WithPriorityHigh(priorityHigh []int64) *TorrentSetRequest

WithPriorityHigh sets indices of high-priority file(s).

func (TorrentSetRequest) WithPriorityLow

func (req TorrentSetRequest) WithPriorityLow(priorityLow []int64) *TorrentSetRequest

WithPriorityLow sets indices of low-priority file(s).

func (TorrentSetRequest) WithPriorityNormal

func (req TorrentSetRequest) WithPriorityNormal(priorityNormal []int64) *TorrentSetRequest

WithPriorityNormal sets indices of normal-priority file(s).

func (TorrentSetRequest) WithQueuePosition

func (req TorrentSetRequest) WithQueuePosition(queuePosition int64) *TorrentSetRequest

WithQueuePosition sets position of this torrent in its queue [0...n).

func (TorrentSetRequest) WithSeedIdleLimit

func (req TorrentSetRequest) WithSeedIdleLimit(seedIdleLimit int64) *TorrentSetRequest

WithSeedIdleLimit sets torrent-level int64 of minutes of seeding inactivity.

func (TorrentSetRequest) WithSeedIdleMode

func (req TorrentSetRequest) WithSeedIdleMode(seedIdleMode Mode) *TorrentSetRequest

WithSeedIdleMode sets which seeding inactivity to use. See tr_idlelimit.

func (TorrentSetRequest) WithSeedRatioLimit

func (req TorrentSetRequest) WithSeedRatioLimit(seedRatioLimit float64) *TorrentSetRequest

WithSeedRatioLimit sets torrent-level seeding ratio.

func (TorrentSetRequest) WithSeedRatioMode

func (req TorrentSetRequest) WithSeedRatioMode(seedRatioMode Mode) *TorrentSetRequest

WithSeedRatioMode sets which ratio to use. See tr_ratiolimit.

func (TorrentSetRequest) WithTrackerAdd

func (req TorrentSetRequest) WithTrackerAdd(trackerAdd ...string) *TorrentSetRequest

WithTrackerAdd sets strings of announce URLs to add.

func (TorrentSetRequest) WithTrackerRemove

func (req TorrentSetRequest) WithTrackerRemove(trackerRemove ...int64) *TorrentSetRequest

WithTrackerRemove sets ids of trackers to remove.

func (TorrentSetRequest) WithTrackerReplace

func (req TorrentSetRequest) WithTrackerReplace(trackerReplace ...interface{}) *TorrentSetRequest

WithTrackerReplace sets pairs of <trackerId/new announce URLs>.

func (TorrentSetRequest) WithUploadLimit

func (req TorrentSetRequest) WithUploadLimit(uploadLimit int64) *TorrentSetRequest

WithUploadLimit sets maximum upload speed (KBps).

func (TorrentSetRequest) WithUploadLimited

func (req TorrentSetRequest) WithUploadLimited(uploadLimited bool) *TorrentSetRequest

WithUploadLimited sets true if uploadLimit is honored.

type TorrentStartNowRequest

type TorrentStartNowRequest = Request

TorrentStartNowRequest is the torrent start now request.

func TorrentStartNow

func TorrentStartNow(ids ...interface{}) *TorrentStartNowRequest

TorrentStartNow creates a torrent start now request for the specified ids.

type TorrentStartRequest

type TorrentStartRequest = Request

TorrentStartRequest is a torrent start request.

func TorrentStart

func TorrentStart(ids ...interface{}) *TorrentStartRequest

TorrentStart creates a torrent start request for the specified ids.

type TorrentStopRequest

type TorrentStopRequest = Request

TorrentStopRequest is the torrent stop request.

func TorrentStop

func TorrentStop(ids ...interface{}) *TorrentStopRequest

TorrentStop creates a torrent stop request for the specified ids.

type TorrentVerifyRequest

type TorrentVerifyRequest = Request

TorrentVerifyRequest is the torrent verify request.

func TorrentVerify

func TorrentVerify(ids ...interface{}) *TorrentVerifyRequest

TorrentVerify creates a torrent verify request for the specified ids

type Units

type Units struct {
	SpeedUnits  []string `json:"speed-units,omitempty" yaml:"speed-units,omitempty"`   // 4 strings: KB/s, MB/s, GB/s, TB/s
	SpeedBytes  int64    `json:"speed-bytes,omitempty" yaml:"speed-bytes,omitempty"`   // number of bytes in a KB (1000 for kB; 1024 for KiB)
	SizeUnits   []string `json:"size-units,omitempty" yaml:"size-units,omitempty"`     // 4 strings: KB/s, MB/s, GB/s, TB/s
	SizeBytes   int64    `json:"size-bytes,omitempty" yaml:"size-bytes,omitempty"`     // number of bytes in a KB (1000 for kB; 1024 for KiB)
	MemoryUnits []string `json:"memory-units,omitempty" yaml:"memory-units,omitempty"` // 4 strings: KB/s, MB/s, GB/s, TB/s
	MemoryBytes int64    `json:"memory-bytes,omitempty" yaml:"memory-bytes,omitempty"` // number of bytes in a KB (1000 for kB; 1024 for KiB)
}

Units are session units.

Directories

Path Synopsis
_example/example.go
_example/example.go

Jump to

Keyboard shortcuts

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