settings

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptionPolicy

type EncryptionPolicy int
const (
	EncryptionEnabledPolicy EncryptionPolicy = iota
	EncryptionDisabledPolicy
	EncryptionForcedPolicy
)

type ProxySettings

type ProxySettings struct {
	Type     ProxyType `json:"type" validate:"gte=0,lte=6"`
	Port     int       `json:"port" validate:"gte=0,lte=65535"`
	Hostname string    `json:"hostname"`
	Username string    `json:"username"`
	Password string    `json:"password"`
}

type ProxyType

type ProxyType int
const (
	ProxyTypeNone ProxyType = iota
	ProxyTypeSocks4
	ProxyTypeSocks5
	ProxyTypeSocks5Password
	ProxyTypeSocksHTTP
	ProxyTypeSocksHTTPPassword
	ProxyTypeI2PSAM
)

noinspection GoUnusedConst

type Settings

type Settings struct {
	ListenPort           uint             `json:"listen_port" validate:"gte=0,lte=65535" example:"6889"`
	ListenInterfaces     string           `json:"listen_interfaces" example:""`
	OutgoingInterfaces   string           `json:"outgoing_interfaces" example:""`
	DisableDHT           bool             `json:"disable_dht" example:"false"`
	DisableUPNP          bool             `json:"disable_upnp" example:"false"`
	DisableNatPMP        bool             `json:"disable_natpmp" example:"false"`
	DisableLSD           bool             `json:"disable_lsd" example:"false"`
	DownloadPath         string           `json:"download_path" validate:"required" example:"downloads"`
	TorrentsPath         string           `json:"torrents_path" validate:"required" example:"downloads/torrents"`
	UserAgent            UserAgentType    `json:"user_agent" validate:"gte=0,lte=6" example:"0"`
	SessionSave          time.Duration    `json:"session_save" validate:"gt=0" example:"30" swaggertype:"integer"`
	TunedStorage         bool             `json:"tuned_storage" example:"false"`
	CheckAvailableSpace  bool             `json:"check_available_space" example:"true"`
	ConnectionsLimit     int              `json:"connections_limit" example:"200"`
	LimitAfterBuffering  bool             `json:"limit_after_buffering" example:"false"`
	MaxDownloadRate      int              `json:"max_download_rate" validate:"gte=0" example:"0"`
	MaxUploadRate        int              `json:"max_upload_rate" validate:"gte=0" example:"0"`
	ShareRatioLimit      int              `json:"share_ratio_limit" validate:"gte=0" example:"200"`
	SeedTimeRatioLimit   int              `json:"seed_time_ratio_limit" validate:"gte=0" example:"700"`
	SeedTimeLimit        int              `json:"seed_time_limit" validate:"gte=0" example:"86400"`
	ActiveDownloadsLimit int              `json:"active_downloads_limit" example:"3"`
	ActiveSeedsLimit     int              `json:"active_seeds_limit" example:"5"`
	ActiveCheckingLimit  int              `json:"active_checking_limit" example:"1"`
	ActiveDhtLimit       int              `json:"active_dht_limit" example:"88"`
	ActiveTrackerLimit   int              `json:"active_tracker_limit" example:"1600"`
	ActiveLsdLimit       int              `json:"active_lsd_limit" example:"60"`
	ActiveLimit          int              `json:"active_limit" example:"500"`
	EncryptionPolicy     EncryptionPolicy `json:"encryption_policy" validate:"gte=0,lte=2" example:"0"`
	Proxy                *ProxySettings   `json:"proxy"`
	BufferSize           int64            `json:"buffer_size" example:"20971520"`
	PieceWaitTimeout     time.Duration    `json:"piece_wait_timeout" validate:"gte=0" example:"60" swaggertype:"integer"`
	ServiceLogLevel      logging.Level    `json:"service_log_level" validate:"gte=0,lte=5" example:"4" swaggertype:"integer"`
	AlertsLogLevel       logging.Level    `json:"alerts_log_level" validate:"gte=0,lte=5" example:"0" swaggertype:"integer"`
	ApiLogLevel          logging.Level    `json:"api_log_level" validate:"gte=0,lte=5" example:"1" swaggertype:"integer"`
	// contains filtered or unexported fields
}

Settings define the server settings

func DefaultSettings

func DefaultSettings() *Settings

func Load

func Load(path string) (s *Settings, err error)

Load loads settings from path

func (*Settings) Clone

func (s *Settings) Clone() *Settings

Clone clones the settings

func (*Settings) Save

func (s *Settings) Save() (err error)

Save saves the current settings to path

func (*Settings) SetSettingsPath

func (s *Settings) SetSettingsPath(path string)

SetSettingsPath sets the path where to save settings

func (*Settings) Update

func (s *Settings) Update(data []byte) (err error)

Update updates the settings with the json object provided

func (*Settings) UpdateFrom added in v0.0.8

func (s *Settings) UpdateFrom(settings *Settings) error

UpdateFrom updates the settings with the settings object provided

type UserAgentType

type UserAgentType int
const (
	DefaultUA UserAgentType = iota
	LibtorrentUA
	LibtorrentRasterbar_1_1_0_UA
	BitTorrent_7_5_0_UA
	BitTorrent_7_4_3_UA
	UTorrent_3_4_9_UA
	UTorrent_3_2_0_UA
	UTorrent_2_2_1_UA
	Transmission_2_92_UA
	Deluge_1_3_6_0_UA
	Deluge_1_3_12_0_UA
	Vuze_5_7_3_0_UA
)

noinspection GoSnakeCaseUsage

Jump to

Keyboard shortcuts

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