config

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BRUSH_CAT      = "_brush"
	XSEED_TAG      = "_xseed"
	STATS_FILENAME = "ptool_stats.txt"

	DEFAULT_SITE_TIMEZONE                           = "Asia/Shanghai"
	DEFAULT_CLIENT_BRUSH_MIN_DISK_SPACE             = int64(5 * 1024 * 1024 * 1024)
	DEFAULT_CLIENT_BRUSH_SLOW_UPLOAD_SPEED_TIER     = int64(100 * 1024)
	DEFAULT_CLIENT_BRUSH_MAX_DOWNLOADING_TORRENTS   = int64(6)
	DEFAULT_CLIENT_BRUSH_MAX_TORRENTS               = int64(9999)
	DEFAULT_CLIENT_BRUSH_MIN_RATION                 = float64(0.2)
	DEFAULT_CLIENT_BRUSH_DEFAULT_UPLOAD_SPEED_LIMIT = int64(10 * 1024 * 1024)
	DEFAULT_CLIENT_BRUSH_TORRENT_MIN_SIZE_LIMIT     = int64(0)
	DEFAULT_CLIENT_BRUSH_TORRENT_MAX_SIZE_LIMIT     = int64(1024 * 1024 * 1024 * 1024 * 1024) // 1PB, that's say, unlimited
	DEFAULT_SITE_TORRENT_UPLOAD_SPEED_LIMIT         = int64(10 * 1024 * 1024)
)

Variables

View Source
var (
	VerboseLevel = 0
	ConfigDir    = ""
	ConfigFile   = ""
)

Functions

func GetGroupSites

func GetGroupSites(name string) []string

if name is a group, return it's sites, otherwise return nil

func MatchSite added in v0.1.1

func MatchSite(domain string, siteConfig *SiteConfigStruct) bool

func ParseGroupAndOtherNames

func ParseGroupAndOtherNames(names ...string) []string

parse an slice of groupOrOther names, expand group name to site names, return the final slice of names

func ParseGroupAndOtherNamesWithoutDeduplicate

func ParseGroupAndOtherNamesWithoutDeduplicate(names ...string) []string

Types

type ClientConfigStruct

type ClientConfigStruct struct {
	Type                              string  `yaml:"type"`
	Name                              string  `yaml:"name"`
	Disabled                          bool    `yaml:"disabled"`
	Url                               string  `yaml:"url"`
	Username                          string  `yaml:"username"`
	Password                          string  `yaml:"password"`
	BrushMinDiskSpace                 string  `yaml:"brushMinDiskSpace"`
	BrushSlowUploadSpeedTier          string  `yaml:"brushSlowUploadSpeedTier"`
	BrushMaxDownloadingTorrents       int64   `yaml:"brushMaxDownloadingTorrents"`
	BrushMaxTorrents                  int64   `yaml:"brushMaxTorrents"`
	BrushMinRatio                     float64 `yaml:"brushMinRatio"`
	BrushDefaultUploadSpeedLimit      string  `yaml:"brushDefaultUploadSpeedLimit"`
	BrushTorrentMinSizeLimit          string  `yaml:"brushTorrentMinSizeLimit"`
	BrushTorrentMaxSizeLimit          string  `yaml:"brushTorrentMaxSizeLimit"`
	BrushMinDiskSpaceValue            int64
	BrushSlowUploadSpeedTierValue     int64
	BrushDefaultUploadSpeedLimitValue int64
	BrushTorrentMinSizeLimitValue     int64
	BrushTorrentMaxSizeLimitValue     int64
	QbittorrentNoLogin                bool `yaml:"qbittorrentNoLogin"` // if set, will NOT send login request
}

func GetClientConfig

func GetClientConfig(name string) *ClientConfigStruct

type ConfigStruct

type ConfigStruct struct {
	IyuuToken        string                `yaml:"iyuuToken"`
	SiteProxy        string                `yaml:"siteProxy"`
	SiteUserAgent    string                `yaml:"siteUserAgent"`
	SiteJa3          string                `yaml:"siteJa3"`
	BrushEnableStats bool                  `yaml:"brushEnableStats"`
	Clients          []*ClientConfigStruct `yaml:"clients"`
	Sites            []*SiteConfigStruct   `yaml:"sites"`
	Groups           []*GroupConfigStruct  `yaml:"groups"`
}

func Get

func Get() *ConfigStruct

type GroupConfigStruct

type GroupConfigStruct struct {
	Name  string   `yaml:"name"`
	Sites []string `yaml:"sites"`
}

type SiteConfigStruct

type SiteConfigStruct struct {
	Type                           string   `yaml:"type"`
	Name                           string   `yaml:"name"`
	Aliases                        []string // for internal use only
	Comment                        string   `yaml:"comment"`
	Disabled                       bool     `yaml:"disabled"`
	Url                            string   `yaml:"url"`
	Domains                        []string `yaml:"domains"` // other site domains (do not include subdomain part)
	TorrentsUrl                    string   `yaml:"torrentsUrl"`
	SearchUrl                      string   `yaml:"searchUrl"`
	TorrentsExtraUrls              []string `yaml:"torrentsExtraUrls"`
	Cookie                         string   `yaml:"cookie"`
	UserAgent                      string   `yaml:"userAgent"`
	Ja3                            string   `yaml:"ja3"`
	Proxy                          string   `yaml:"proxy"`
	TorrentUploadSpeedLimit        string   `yaml:"torrentUploadSpeedLimit"`
	GlobalHnR                      bool     `yaml:"globalHnR"`
	Timezone                       string   `yaml:"timezone"`
	BrushAllowNoneFree             bool     `yaml:"brushAllowNoneFree"`
	BrushAllowPaid                 bool     `yaml:"brushAllowPaid"`
	BrushAllowZeroSeeders          bool     `yaml:"brushAllowZeroSeeders"`
	SelectorTorrentsListHeader     string   `yaml:"selectorTorrentsListHeader"`
	SelectorTorrentsList           string   `yaml:"selectorTorrentsList"`
	SelectorTorrentBlock           string   `yaml:"selectorTorrentBlock"` // dom block of a torrent in list
	SelectorTorrent                string   `yaml:"selectorTorrent"`
	SelectorTorrentDownloadLink    string   `yaml:"selectorTorrentDownloadLink"`
	SelectorTorrentDetailsLink     string   `yaml:"selectorTorrentDetailsLink"`
	SelectorTorrentTime            string   `yaml:"selectorTorrentTime"`
	SelectorTorrentSeeders         string   `yaml:"selectorTorrentSeeders"`
	SelectorTorrentLeechers        string   `yaml:"selectorTorrentLeechers"`
	SelectorTorrentSnatched        string   `yaml:"selectorTorrentSnatched"`
	SelectorTorrentSize            string   `yaml:"selectorTorrentSize"`
	SelectorTorrentProcessBar      string   `yaml:"selectorTorrentProcessBar"`
	SelectorTorrentFree            string   `yaml:"SelectorTorrentFree"`
	SelectorTorrentPaid            string   `yaml:"selectorTorrentPaid"`
	SelectorTorrentDiscountEndTime string   `yaml:"selectorTorrentDiscountEndTime"`
	SelectorUserInfo               string   `yaml:"selectorUserInfo"`
	SelectorUserInfoUserName       string   `yaml:"selectorUserInfoUserName"`
	SelectorUserInfoUploaded       string   `yaml:"selectorUserInfoUploaded"`
	SelectorUserInfoDownloaded     string   `yaml:"selectorUserInfoDownloaded"`
	UseCuhash                      bool     `yaml:"useCuhash"` // hdcity 使用机制。种子下载地址里必须有cuhash参数。
	TorrentUrlIdRegexp             string   `yaml:"torrentUrlIdRegexp"`
	TorrentUploadSpeedLimitValue   int64
}

func GetSiteConfig added in v0.1.1

func GetSiteConfig(name string) *SiteConfigStruct

func (*SiteConfigStruct) GetName

func (siteConfig *SiteConfigStruct) GetName() string

func (*SiteConfigStruct) ParseSiteUrl

func (siteConfig *SiteConfigStruct) ParseSiteUrl(siteUrl string, appendQueryStringDelimiter bool) string

parse a site internal url (eg. special.php), return absolute url

Jump to

Keyboard shortcuts

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