Documentation
¶
Overview ¶
SPDX-License-Identifier: GPL-3.0-only
Package qbt provides a high-level, production-ready client for the qBittorrent Web API.
Highlights:
- Smart cookie/session management with in-memory cache and periodic cleanup
- Automatic retries with exponential backoff for transient failures
- Configurable timeouts and retry policies
- Clean, well-typed models for common endpoints
Quick start:
import (
"log"
qbt "github.com/jfxdev/go-qbt"
)
func main() {
client, err := qbt.New(qbt.Config{
BaseURL: "http://localhost:8080",
Username: "admin",
Password: "password",
})
if err != nil {
log.Fatal(err)
}
defer client.Close()
// List all torrents
_, _ = client.ListTorrents(qbt.ListOptions{})
}
Index ¶
- Constants
- func IsPermanentError(err error) bool
- func IsRetryableError(err error) bool
- type BuildInfoResponse
- type Category
- type Client
- func (qb *Client) AddRSSFeed(feedURL, path string) error
- func (qb *Client) AddTorrentLink(opts TorrentConfig) error
- func (qb *Client) AddTorrentTags(hash string, tags []string) error
- func (qb *Client) Close() error
- func (qb *Client) CreateCategory(name, savePath string) error
- func (qb *Client) DecreaseTorrentsPriority(hash string) error
- func (qb *Client) DeleteCategory(name string) error
- func (qb *Client) DeleteTorrentTags(hash string, tags []string) error
- func (qb *Client) DeleteTorrents(hash string, deleteFiles bool) error
- func (qb *Client) ForceReannounce(hash string) error
- func (qb *Client) ForceRecheck(hash string) error
- func (qb *Client) ForceStart(hash string) error
- func (qb *Client) GetAPIVersion() (string, error)
- func (qb *Client) GetAppVersion() (string, error)
- func (qb *Client) GetBuildInfo() (*TransferInfoResponse, error)
- func (qb *Client) GetCategories() (map[string]Category, error)
- func (qb *Client) GetConnectionStatus() *ConnectionStatus
- func (qb *Client) GetGlobalDownloadLimit() (int, error)
- func (qb *Client) GetGlobalSettings() (*GlobalSettings, error)
- func (qb *Client) GetGlobalUploadLimit() (int, error)
- func (qb *Client) GetLastError() *ClientError
- func (qb *Client) GetLogs(normal bool, info bool, warning bool, critical bool, lastKnownID int) ([]*LogEntry, error)
- func (qb *Client) GetMainData() (*MainDataResponse, error)
- func (qb *Client) GetNetworkInfo() (*NetworkInfo, error)
- func (qb *Client) GetPeerLogs(lastKnownID int) ([]*PeerLogEntry, error)
- func (qb *Client) GetRSSFeeds(withData bool) (map[string]RSSFeed, error)
- func (qb *Client) GetStatus() string
- func (qb *Client) GetTorrent(hash string) (*TorrentResponse, error)
- func (qb *Client) GetTorrentDownloadLimit(hash string) (int, error)
- func (qb *Client) GetTorrentPeers(hash string) ([]*TorrentPeer, error)
- func (qb *Client) GetTorrentProperties(hash string) (*TorrentProperties, error)
- func (qb *Client) GetTorrentTrackers(hash string) ([]*TorrentTracker, error)
- func (qb *Client) GetTorrentUploadLimit(hash string) (int, error)
- func (qb *Client) GetTransferInfo() (*TransferInfoResponse, error)
- func (qb *Client) IncreaseTorrentsPriority(hash string) error
- func (qb *Client) IsAuthFailed() bool
- func (qb *Client) ListTorrentFiles(hash string) ([]*TorrentFile, error)
- func (qb *Client) ListTorrents(opts ListOptions) ([]*TorrentResponse, error)
- func (qb *Client) RemoveCategory(hash string) error
- func (qb *Client) RemoveRSSFeed(path string) error
- func (qb *Client) RenameTorrent(hash string, newName string) error
- func (qb *Client) ResetAuthFailure()
- func (qb *Client) SetAlternativeRateLimits(downloadLimit, uploadLimit int) error
- func (qb *Client) SetCategory(hash string, category string) error
- func (qb *Client) SetGlobalDownloadSpeedLimit(limit int) error
- func (qb *Client) SetGlobalSettings(settings GlobalSettings) error
- func (qb *Client) SetGlobalUploadSpeedLimit(limit int) error
- func (qb *Client) SetLastError(err error)
- func (qb *Client) SetMaxActiveTorrentLimits(maxDownloads, maxUploads, maxTorrents, maxChecking int) error
- func (qb *Client) SetTorrentDownloadLimit(hash string, limit int) error
- func (qb *Client) SetTorrentLocation(hash string, location string) error
- func (qb *Client) SetTorrentShareLimit(hash string, ratioLimit float64, seedingTimeLimit int, ...) error
- func (qb *Client) SetTorrentUploadLimit(hash string, limit int) error
- func (qb *Client) StartTorrent(hash string) error
- func (qb *Client) StartTorrents(hash string) error
- func (qb *Client) Status() string
- func (qb *Client) StopTorrent(hash string) error
- func (qb *Client) StopTorrents(hash string) error
- func (qb *Client) SuperSeedingMode(hash string, enabled bool) error
- func (qb *Client) ToggleSpeedLimits() error
- func (qb *Client) Update(config Config)
- type ClientError
- type Config
- type ConnectionStatus
- type CookieCache
- type ErrorCode
- type GlobalSettings
- type ListFilter
- type ListOptions
- type LogEntry
- type MagnetLink
- type MainDataResponse
- type MainDataServerStateResponse
- type NetworkInfo
- type PeerLogEntry
- type RSSArticle
- type RSSFeed
- type RetryConfig
- type TorrentConfig
- type TorrentFile
- type TorrentPeer
- type TorrentProperties
- type TorrentResponse
- type TorrentTracker
- type TransferInfoResponse
Constants ¶
const ( DefaultRequestTimeout = 30 * time.Second DefaultMaxRetries = 3 DefaultRetryBackoff = 1 * time.Second DefaultMaxDelay = 30 * time.Second DefaultBackoffFactor = 2.0 CookieExpiryDuration = 24 * time.Hour CookieCheckInterval = 5 * time.Minute )
Default configuration constants
const ( StatusConnected = "connected" StatusUnaccessible = "unaccessible" StatusInitializing = "initializing" StatusPending = "pending" StatusError = "error" )
Variables ¶
This section is empty.
Functions ¶
func IsPermanentError ¶ added in v1.0.19
IsPermanentError returns true if the error requires user intervention
func IsRetryableError ¶ added in v1.0.19
IsRetryableError returns true if the error is temporary and can be retried
Types ¶
type BuildInfoResponse ¶ added in v1.0.10
type BuildInfoResponse struct {
DlInfoSpeed int `json:"dl_info_speed"`
DlInfoData int `json:"dl_info_data"`
UpInfoSpeed int `json:"up_info_speed"`
UpInfoData int `json:"up_info_data"`
DlRateLimit int `json:"dl_rate_limit"`
UpRateLimit int `json:"up_rate_limit"`
DhtNodes int `json:"dht_nodes"`
ConnectionStatus string `json:"connection_status"`
}
type Category ¶ added in v1.0.11
type Category struct {
Name string `json:"name"` // Category name
SavePath string `json:"savePath"` // Save path for this category
}
Category represents a torrent category
type Client ¶
type Client struct {
MaxLoginRetries int
RetryDelay time.Duration
// contains filtered or unexported fields
}
Client is a high-level qBittorrent API client with cookie cache and retries.
func (*Client) AddRSSFeed ¶ added in v1.0.11
AddRSSFeed adds a new RSS feed
func (*Client) AddTorrentLink ¶
func (qb *Client) AddTorrentLink(opts TorrentConfig) error
func (*Client) AddTorrentTags ¶ added in v1.0.3
func (*Client) CreateCategory ¶ added in v1.0.11
CreateCategory creates a new category
func (*Client) DecreaseTorrentsPriority ¶
func (*Client) DeleteCategory ¶ added in v1.0.11
DeleteCategory removes a category
func (*Client) DeleteTorrentTags ¶ added in v1.0.11
func (*Client) DeleteTorrents ¶
func (*Client) ForceReannounce ¶ added in v1.0.11
func (*Client) ForceRecheck ¶ added in v1.0.11
func (*Client) ForceStart ¶ added in v1.0.11
func (*Client) GetAPIVersion ¶ added in v1.0.10
func (*Client) GetAppVersion ¶ added in v1.0.10
func (*Client) GetBuildInfo ¶ added in v1.0.10
func (qb *Client) GetBuildInfo() (*TransferInfoResponse, error)
func (*Client) GetCategories ¶ added in v1.0.11
GetCategories gets all categories
func (*Client) GetConnectionStatus ¶ added in v1.0.19
func (qb *Client) GetConnectionStatus() *ConnectionStatus
GetConnectionStatus returns the detailed connection status
func (*Client) GetGlobalDownloadLimit ¶ added in v1.0.15
GetGlobalDownloadLimit gets the global download speed limit
func (*Client) GetGlobalSettings ¶ added in v1.0.11
func (qb *Client) GetGlobalSettings() (*GlobalSettings, error)
GetGlobalSettings gets qBittorrent global settings
func (*Client) GetGlobalUploadLimit ¶ added in v1.0.15
GetGlobalUploadLimit gets the global upload speed limit
func (*Client) GetLastError ¶ added in v1.0.19
func (qb *Client) GetLastError() *ClientError
GetLastError returns the last error that occurred
func (*Client) GetLogs ¶ added in v1.0.11
func (qb *Client) GetLogs(normal bool, info bool, warning bool, critical bool, lastKnownID int) ([]*LogEntry, error)
GetLogs gets system logs
func (*Client) GetMainData ¶ added in v1.0.7
func (qb *Client) GetMainData() (*MainDataResponse, error)
func (*Client) GetNetworkInfo ¶ added in v1.0.11
func (qb *Client) GetNetworkInfo() (*NetworkInfo, error)
GetNetworkInfo gets network information
func (*Client) GetPeerLogs ¶ added in v1.0.20
func (qb *Client) GetPeerLogs(lastKnownID int) ([]*PeerLogEntry, error)
GetPeerLogs gets peer logs
func (*Client) GetRSSFeeds ¶ added in v1.0.11
GetRSSFeeds gets configured RSS feeds
func (*Client) GetTorrent ¶ added in v1.0.11
func (qb *Client) GetTorrent(hash string) (*TorrentResponse, error)
func (*Client) GetTorrentDownloadLimit ¶ added in v1.0.15
GetTorrentDownloadLimit gets download speed limit for a specific torrent
func (*Client) GetTorrentPeers ¶ added in v1.0.11
func (qb *Client) GetTorrentPeers(hash string) ([]*TorrentPeer, error)
GetTorrentPeers gets peer information for a torrent
func (*Client) GetTorrentProperties ¶ added in v1.0.11
func (qb *Client) GetTorrentProperties(hash string) (*TorrentProperties, error)
func (*Client) GetTorrentTrackers ¶ added in v1.0.11
func (qb *Client) GetTorrentTrackers(hash string) ([]*TorrentTracker, error)
GetTorrentTrackers gets tracker information for a torrent
func (*Client) GetTorrentUploadLimit ¶ added in v1.0.15
GetTorrentUploadLimit gets upload speed limit for a specific torrent
func (*Client) GetTransferInfo ¶ added in v1.0.8
func (qb *Client) GetTransferInfo() (*TransferInfoResponse, error)
func (*Client) IncreaseTorrentsPriority ¶
func (*Client) IsAuthFailed ¶ added in v1.0.19
IsAuthFailed returns true if authentication has permanently failed
func (*Client) ListTorrentFiles ¶ added in v1.0.11
func (qb *Client) ListTorrentFiles(hash string) ([]*TorrentFile, error)
func (*Client) ListTorrents ¶
func (qb *Client) ListTorrents(opts ListOptions) ([]*TorrentResponse, error)
func (*Client) RemoveCategory ¶ added in v1.0.11
func (*Client) RemoveRSSFeed ¶ added in v1.0.11
RemoveRSSFeed removes an RSS feed
func (*Client) RenameTorrent ¶ added in v1.0.13
RenameTorrent renames a torrent
func (*Client) ResetAuthFailure ¶ added in v1.0.19
func (qb *Client) ResetAuthFailure()
ResetAuthFailure resets the authentication failure flag (call after credential update)
func (*Client) SetAlternativeRateLimits ¶ added in v1.0.13
SetAlternativeRateLimits sets alternative global download and upload speed limits
func (*Client) SetCategory ¶ added in v1.0.11
func (*Client) SetGlobalDownloadSpeedLimit ¶ added in v1.0.18
SetGlobalDownloadSpeedLimit sets the download speed limit
func (*Client) SetGlobalSettings ¶ added in v1.0.11
func (qb *Client) SetGlobalSettings(settings GlobalSettings) error
SetGlobalSettings sets qBittorrent global settings
func (*Client) SetGlobalUploadSpeedLimit ¶ added in v1.0.18
SetGlobalUploadSpeedLimit sets the upload speed limit
func (*Client) SetLastError ¶ added in v1.0.19
SetLastError stores the last error that occurred
func (*Client) SetMaxActiveTorrentLimits ¶ added in v1.0.13
func (qb *Client) SetMaxActiveTorrentLimits(maxDownloads, maxUploads, maxTorrents, maxChecking int) error
SetMaxActiveTorrentLimits sets all maximum active torrent limits at once
func (*Client) SetTorrentDownloadLimit ¶ added in v1.0.11
SetTorrentDownloadLimit sets download speed limit for a specific torrent
func (*Client) SetTorrentLocation ¶ added in v1.0.13
SetTorrentLocation sets the location for torrent files
func (*Client) SetTorrentShareLimit ¶ added in v1.0.11
func (qb *Client) SetTorrentShareLimit(hash string, ratioLimit float64, seedingTimeLimit int, inactiveSeedingTimeLimit int) error
SetTorrentShareLimit sets share limits for a specific torrent ratioLimit: -2 means use global limit, -1 means no limit seedingTimeLimit: -2 means use global limit, -1 means no limit (in minutes) inactiveSeedingTimeLimit: -2 means use global limit, -1 means no limit (in minutes)
func (*Client) SetTorrentUploadLimit ¶ added in v1.0.11
SetTorrentUploadLimit sets upload speed limit for a specific torrent
func (*Client) StartTorrent ¶ added in v1.0.11
func (*Client) StartTorrents ¶ added in v1.0.14
func (*Client) StopTorrent ¶ added in v1.0.11
func (*Client) StopTorrents ¶ added in v1.0.14
func (*Client) SuperSeedingMode ¶ added in v1.0.13
SuperSeedingMode enables or disables super seeding for a torrent
func (*Client) ToggleSpeedLimits ¶ added in v1.0.11
ToggleSpeedLimits toggles speed limits
type ClientError ¶ added in v1.0.19
type ClientError struct {
Code ErrorCode
Message string
Err error
// Permanent indicates whether this error requires user intervention (true)
// or can be resolved by retrying (false)
Permanent bool
}
ClientError represents a structured error with classification
func ClassifyError ¶ added in v1.0.19
func ClassifyError(err error) *ClientError
ClassifyError analyzes an error and returns a structured ClientError
func NewClientError ¶ added in v1.0.19
func NewClientError(code ErrorCode, message string, err error, permanent bool) *ClientError
NewClientError creates a new ClientError
func (*ClientError) Error ¶ added in v1.0.19
func (e *ClientError) Error() string
func (*ClientError) IsPermanent ¶ added in v1.0.19
func (e *ClientError) IsPermanent() bool
IsPermanent returns true if the error requires user intervention
func (*ClientError) Unwrap ¶ added in v1.0.19
func (e *ClientError) Unwrap() error
type Config ¶ added in v1.0.2
type Config struct {
BaseURL string
Username string
Password string
RequestTimeout time.Duration
MaxRetries int
RetryBackoff time.Duration
Debug bool // Enable debug logging for session management
// contains filtered or unexported fields
}
Config contains runtime client settings and credentials.
type ConnectionStatus ¶ added in v1.0.19
type ConnectionStatus struct {
Status string `json:"status"`
ErrorCode ErrorCode `json:"error_code,omitempty"`
Message string `json:"message,omitempty"`
Permanent bool `json:"permanent,omitempty"`
}
ConnectionStatus represents the detailed connection state of the client
type CookieCache ¶ added in v1.0.9
type CookieCache struct {
// contains filtered or unexported fields
}
CookieCache stores session cookies to reduce validation requests.
type ErrorCode ¶ added in v1.0.19
type ErrorCode string
ErrorCode represents a specific error type for client-side handling
const ( // ErrorCodeNone indicates no error ErrorCodeNone ErrorCode = "" // ErrorCodeAuthFailure indicates invalid username/password - requires user intervention ErrorCodeAuthFailure ErrorCode = "AUTH_FAILURE" // ErrorCodeTimeout indicates connection or request timeout - temporary, can retry ErrorCodeTimeout ErrorCode = "TIMEOUT" // ErrorCodeDNS indicates DNS resolution failure - check hostname configuration ErrorCodeDNS ErrorCode = "DNS_ERROR" // ErrorCodeHTTPSRequired indicates HTTP was used but HTTPS is required ErrorCodeHTTPSRequired ErrorCode = "HTTPS_REQUIRED" // ErrorCodeSSLError indicates SSL/TLS certificate or connection error ErrorCodeSSLError ErrorCode = "SSL_ERROR" // ErrorCodeVersionIncompatible indicates incompatible qBittorrent version ErrorCodeVersionIncompatible ErrorCode = "VERSION_INCOMPATIBLE" // ErrorCodeConnectionRefused indicates the server actively refused the connection ErrorCodeConnectionRefused ErrorCode = "CONNECTION_REFUSED" // ErrorCodeNetworkUnreachable indicates network routing issues ErrorCodeNetworkUnreachable ErrorCode = "NETWORK_UNREACHABLE" // ErrorCodeBadGateway indicates a proxy/gateway error (502) ErrorCodeBadGateway ErrorCode = "BAD_GATEWAY" ErrorCodeServiceUnavailable ErrorCode = "SERVICE_UNAVAILABLE" // ErrorCodeUnknown indicates an unclassified error ErrorCodeUnknown ErrorCode = "UNKNOWN" )
func GetErrorCode ¶ added in v1.0.19
GetErrorCode extracts the error code from an error
type GlobalSettings ¶ added in v1.0.11
type GlobalSettings struct {
Locale string `json:"locale"` // Interface language
CreateSubfolderEnabled bool `json:"create_subfolder_enabled"` // Create subfolder
StartPausedEnabled bool `json:"start_paused_enabled"` // Start paused
AutoDeleteMode int `json:"auto_delete_mode"` // Auto delete mode
SavePath string `json:"save_path"` // Default save path
MaxRatioEnabled bool `json:"max_ratio_enabled"` // Max ratio enabled
MaxRatio float64 `json:"max_ratio"` // Max ratio
MaxRatioAct int `json:"max_ratio_act"` // Max ratio action
ListenPort int `json:"listen_port"` // Listen port
MaxActiveTorrents int `json:"max_active_torrents"` // Max active torrents
MaxActiveDownloads int `json:"max_active_downloads"` // Max active downloads
MaxActiveUploads int `json:"max_active_uploads"` // Max active uploads
MaxActiveCheckingTorrents int `json:"max_active_checking_torrents"` // Max active checking torrents
AlternativeGlobalSpeedLimit int `json:"alternative_global_speed_limit"` // Alternative global speed limit
AlternativeGlobalSpeedLimitEnabled bool `json:"alternative_global_speed_limit_enabled"` // Alternative global speed limit enabled
GlobalSpeedLimit int `json:"global_speed_limit"` // Global speed limit
GlobalSpeedLimitEnabled bool `json:"global_speed_limit_enabled"` // Global speed limit enabled
AltGlobalSpeedLimit int `json:"alt_global_speed_limit"` // Alt global speed limit
AltGlobalSpeedLimitEnabled bool `json:"alt_global_speed_limit_enabled"` // Alt global speed limit enabled
GlobalDLSpeedLimit int `json:"global_dl_speed_limit"` // Global download speed limit
GlobalDLSpeedLimitEnabled bool `json:"global_dl_speed_limit_enabled"` // Global download speed limit enabled
GlobalUPSpeedLimit int `json:"global_up_speed_limit"` // Global upload speed limit
GlobalUPSpeedLimitEnabled bool `json:"global_up_speed_limit_enabled"` // Global upload speed limit enabled
}
GlobalSettings represents qBittorrent global settings
type ListFilter ¶
type ListFilter struct {
Category string
}
ListFilter is deprecated; use ListOptions instead.
type ListOptions ¶
type ListOptions struct {
Category string
}
ListOptions filters listing endpoints.
type LogEntry ¶ added in v1.0.11
type LogEntry struct {
ID int `json:"id"` // Log entry ID
Message string `json:"message"` // Log message
Timestamp int64 `json:"timestamp"` // Timestamp
Type int `json:"type"` // Log type (normal=1, info=2, warning=4, critical=8)
}
LogEntry represents a log entry
type MagnetLink ¶ added in v1.0.11
type MagnetLink struct {
Hash string `json:"hash"` // Hash of the torrent (btih)
DisplayName string `json:"display_name"` // File/torrent name (dn)
Trackers []string `json:"trackers"` // List of trackers (tr)
ExactLength string `json:"exact_length"` // Exact length (xl)
ExactSource string `json:"exact_source"` // Exact source (xs)
Keywords string `json:"keywords"` // Keywords (kt)
AcceptableSource string `json:"acceptable_source"` // Acceptable source (as)
}
MagnetLink represents the data extracted from a magnet link
func ParseMagnetLink ¶ added in v1.0.11
func ParseMagnetLink(magnetURI string) (*MagnetLink, error)
ParseMagnetLink extracts information from a magnet link
type MainDataResponse ¶ added in v1.0.7
type MainDataResponse struct {
ServerState MainDataServerStateResponse `json:"server_state"`
}
MainDataResponse represents a subset of sync/maindata response.
type MainDataServerStateResponse ¶ added in v1.0.7
type MainDataServerStateResponse struct {
FreeSpaceOnDisk int `json:"free_space_on_disk"`
AllTimeDownloaded int `json:"alltime_dl"`
AllTimeUploaded int `json:"alltime_ul"`
ConnectionStatus string `json:"connection_status"`
GlobalRatio string `json:"global_ratio"`
LastExternalAddressV4 string `json:"last_external_address_v4"`
LastExternalAddressV6 string `json:"last_external_address_v6"`
}
MainDataServerStateResponse contains server metrics.
type NetworkInfo ¶ added in v1.0.11
type NetworkInfo struct {
ConnectionStatus string `json:"connection_status"` // Connection status
DhtNodes int `json:"dht_nodes"` // DHT nodes
DlInfoData int64 `json:"dl_info_data"` // Downloaded data
DlInfoSpeed int `json:"dl_info_speed"` // Download speed
DlRateLimit int `json:"dl_rate_limit"` // Download rate limit
UpInfoData int64 `json:"up_info_data"` // Uploaded data
UpInfoSpeed int `json:"up_info_speed"` // Upload speed
UpRateLimit int `json:"up_rate_limit"` // Upload rate limit
}
NetworkInfo represents network information
type PeerLogEntry ¶ added in v1.0.20
type PeerLogEntry struct {
ID int `json:"id"` // Log entry ID
IP string `json:"ip"` // IP address
Timestamp int64 `json:"timestamp"` // Timestamp
Blocked bool `json:"blocked"` // Whether the peer was blocked
Reason string `json:"reason"` // Reason for blocking
}
PeerLogEntry represents a peer log entry
type RSSArticle ¶ added in v1.0.11
type RSSArticle struct {
ID string `json:"id"` // Article ID
Title string `json:"title"` // Article title
Summary string `json:"summary"` // Article summary
Link string `json:"link"` // Article link
IsRead bool `json:"isRead"` // Is read
Date string `json:"date"` // Article date
Description string `json:"description"` // Article description
TorrentURL string `json:"torrentURL"` // Torrent URL
Size int64 `json:"size"` // File size
}
RSSArticle represents an RSS article
type RSSFeed ¶ added in v1.0.11
type RSSFeed struct {
URL string `json:"url"` // Feed URL
Title string `json:"title"` // Feed title
LastBuild string `json:"lastBuild"` // Last build date
IsLoading bool `json:"isLoading"` // Is loading
HasError bool `json:"hasError"` // Has error
Articles []RSSArticle `json:"articles"` // Articles
}
RSSFeed represents an RSS feed
type RetryConfig ¶ added in v1.0.9
type RetryConfig struct {
MaxRetries int
BaseDelay time.Duration
MaxDelay time.Duration
BackoffFactor float64
RetryableCodes []int
}
RetryConfig configures retry behavior and backoff parameters.
type TorrentConfig ¶
type TorrentConfig struct {
MagnetURI string
Directory string
Category string
Paused bool
SkipChecking bool
}
TorrentConfig configures new torrent creation.
type TorrentFile ¶ added in v1.0.11
type TorrentFile struct {
Name string `json:"name"` // File name
Size int64 `json:"size"` // File size in bytes
Progress float64 `json:"progress"` // Download progress (0.0 to 1.0)
Priority int `json:"priority"` // File priority
IsSeed bool `json:"is_seed"` // Whether the file is seeded
PieceRange [2]int `json:"piece_range"` // Piece range [start, end]
Availability float64 `json:"availability"` // File availability (0.0 to 1.0)
}
TorrentFile represents a file within a torrent
type TorrentPeer ¶ added in v1.0.11
type TorrentPeer struct {
IP string `json:"ip"` // Peer IP address
Port int `json:"port"` // Peer port
Client string `json:"client"` // Client name
Flags string `json:"flags"` // Peer flags
FlagsDesc string `json:"flags_desc"` // Flags description
Connection string `json:"connection"` // Connection type
Country string `json:"country"` // Country code
CountryCode string `json:"country_code"` // Country code
Downloaded int64 `json:"downloaded"` // Downloaded bytes
DownloadSpeed int `json:"dl_speed"` // Download speed
Files string `json:"files"` // Files
Progress float64 `json:"progress"` // Progress (0.0 to 1.0)
Relevance int `json:"relevance"` // Relevance
Uploaded int64 `json:"uploaded"` // Uploaded bytes
UploadSpeed int `json:"up_speed"` // Upload speed
}
TorrentPeer represents peer information
type TorrentProperties ¶ added in v1.0.11
type TorrentProperties struct {
SavePath string `json:"save_path"` // Save path
CreationDate int64 `json:"creation_date"` // Creation date
PieceSize int64 `json:"piece_size"` // Piece size
Comment string `json:"comment"` // Comment
TotalWasted int64 `json:"total_wasted"` // Total wasted
TotalUploaded int64 `json:"total_uploaded"` // Total uploaded
TotalDownloaded int64 `json:"total_downloaded"` // Total downloaded
UpLimit int `json:"up_limit"` // Upload limit
DlLimit int `json:"dl_limit"` // Download limit
TimeElapsed int `json:"time_elapsed"` // Time elapsed
SeedingTime int `json:"seeding_time"` // Seeding time
NbConnections int `json:"nb_connections"` // Number of connections
NbConnectionsLimit int `json:"nb_connections_limit"` // Number of connections limit
AdditionDate int64 `json:"addition_date"` // Addition date
CompletionDate int64 `json:"completion_date"` // Completion date
CreatedBy string `json:"created_by"` // Created by
DlSpeedAvg int `json:"dl_speed_avg"` // Download speed average
DlSpeed int `json:"dl_speed"` // Download speed
Eta int `json:"eta"` // ETA
LastSeen int `json:"last_seen"` // Last seen
Peers int `json:"peers"` // Peers
PeersTotal int `json:"peers_total"` // Total peers
PiecesHave int `json:"pieces_have"` // Pieces have
PiecesNum int `json:"pieces_num"` // Total pieces
Reannounce int `json:"reannounce"` // Reannounce
Seeds int `json:"seeds"` // Seeds
SeedsTotal int `json:"seeds_total"` // Total seeds
RatioLimit float64 `json:"ratio_limit"` // Ratio limit (-2 = use global, -1 = no limit)
MaxRatio float64 `json:"max_ratio"` // Max ratio (alternative field name, same as ratio_limit)
SeedingTimeLimit int `json:"seeding_time_limit"` // Seeding time limit in minutes (-2 = use global, -1 = no limit)
MaxSeedingTime int `json:"max_seeding_time"` // Max seeding time (alternative field name, same as seeding_time_limit)
InactiveSeedingTimeLimit int `json:"inactive_seeding_time_limit"` // Inactive seeding time limit in minutes (-2 = use global, -1 = no limit)
UpSpeedAvg int `json:"up_speed_avg"` // Upload speed average
UpSpeed int `json:"up_speed"` // Upload speed
}
TorrentProperties represents detailed properties of a torrent
type TorrentResponse ¶ added in v1.0.7
type TorrentResponse struct {
AddedOn int `json:"added_on"`
Category string `json:"category"`
CompletionOn int64 `json:"completion_on"`
Dlspeed int `json:"dlspeed"`
Downloaded int `json:"downloaded"`
Eta int `json:"eta"`
ForceStart bool `json:"force_start"`
Hash string `json:"hash"`
InfoHashV1 string `json:"infohash_v1"`
InfoHashV2 string `json:"infohash_v2"`
MagnetURI string `json:"magnet_uri"`
MagnetLink *MagnetLink `json:"magnet_link"`
Name string `json:"name"`
NumComplete int `json:"num_complete"`
NumIncomplete int `json:"num_incomplete"`
NumLeechs int `json:"num_leechs"`
NumSeeds int `json:"num_seeds"`
Popularity float64 `json:"popularity"`
Priority int `json:"priority"`
Progress float64 `json:"progress"`
Ratio float64 `json:"ratio"`
SavePath string `json:"save_path"`
SeqDl bool `json:"seq_dl"`
Size int `json:"size"`
State string `json:"state"`
SuperSeeding bool `json:"super_seeding"`
Upspeed int `json:"upspeed"`
Uploaded int `json:"uploaded"`
Tags string `json:"tags"`
RatioLimit float64 `json:"ratio_limit"` // Ratio limit (-2 = use global, -1 = no limit)
MaxRatio float64 `json:"max_ratio"` // Max ratio (alternative field name)
SeedingTimeLimit int `json:"seeding_time_limit"` // Seeding time limit in minutes
MaxSeedingTime int `json:"max_seeding_time"` // Max seeding time (alternative field name)
InactiveSeedingTimeLimit int `json:"inactive_seeding_time_limit"` // Inactive seeding time limit in minutes
}
TorrentResponse is a subset of torrent info returned by qBittorrent.
type TorrentTracker ¶ added in v1.0.11
type TorrentTracker struct {
URL string `json:"url"` // Tracker URL
Status int `json:"status"` // Tracker status
Tier int `json:"tier"` // Tracker tier
NumPeers int `json:"num_peers"` // Number of peers
NumSeeds int `json:"num_seeds"` // Number of seeds
NumLeeches int `json:"num_leeches"` // Number of leeches
NumDownloaded int `json:"num_downloaded"` // Number of downloads
Msg string `json:"msg"` // Tracker message
}
TorrentTracker represents tracker information
type TransferInfoResponse ¶ added in v1.0.8
type TransferInfoResponse struct {
DlInfoSpeed int `json:"dl_info_speed"`
DlInfoData int `json:"dl_info_data"`
UpInfoSpeed int `json:"up_info_speed"`
UpInfoData int `json:"up_info_data"`
DlRateLimit int `json:"dl_rate_limit"`
UpRateLimit int `json:"up_rate_limit"`
DhtNodes int `json:"dht_nodes"`
ConnectionStatus string `json:"connection_status"`
}
TransferInfoResponse represents global transfer information.