Documentation ¶
Overview ¶
Package config implements the configuration for a BitTorrent tracker
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{ TrackerConfig: TrackerConfig{ CreateOnAnnounce: true, PrivateEnabled: false, FreeleechEnabled: false, PurgeInactiveTorrents: true, Announce: Duration{30 * time.Minute}, MinAnnounce: Duration{15 * time.Minute}, NumWantFallback: 50, TorrentMapShards: 1, NetConfig: NetConfig{ AllowIPSpoofing: true, DualStackedPeers: true, RespectAF: false, }, WhitelistConfig: WhitelistConfig{ ClientWhitelistEnabled: false, }, }, HTTPConfig: HTTPConfig{ HTTPListenAddr: ":6881", HTTPRequestTimeout: Duration{10 * time.Second}, HTTPReadTimeout: Duration{10 * time.Second}, HTTPWriteTimeout: Duration{10 * time.Second}, }, UDPConfig: UDPConfig{ UDPListenAddr: ":6882", }, DriverConfig: DriverConfig{ Name: "noop", }, StatsConfig: StatsConfig{ BufferSize: 0, IncludeMem: true, VerboseMem: false, MemUpdateInterval: Duration{5 * time.Second}, }, }
DefaultConfig is a configuration that can be used as a fallback value.
var ErrMissingRequiredParam = errors.New("A parameter that was required by a driver is not present")
ErrMissingRequiredParam is used by drivers to indicate that an entry required to be within the DriverConfig.Params map is not present.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { TrackerConfig HTTPConfig UDPConfig DriverConfig StatsConfig }
Config is the global configuration for an instance of Chihaya.
type DriverConfig ¶
type DriverConfig struct { Name string `json:"driver"` Params map[string]string `json:"params,omitempty"` }
DriverConfig is the configuration used to connect to a tracker.Driver or a backend.Driver.
type Duration ¶
Duration wraps a time.Duration and adds JSON marshalling.
func (*Duration) MarshalJSON ¶
MarshalJSON transforms a duration into JSON.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON transform JSON into a Duration.
type HTTPConfig ¶
type HTTPConfig struct { HTTPListenAddr string `json:"http_listen_addr"` HTTPRequestTimeout Duration `json:"http_request_timeout"` HTTPReadTimeout Duration `json:"http_read_timeout"` HTTPWriteTimeout Duration `json:"http_write_timeout"` HTTPListenLimit int `json:"http_listen_limit"` }
HTTPConfig is the configuration for HTTP functionality.
type NetConfig ¶
type NetConfig struct { AllowIPSpoofing bool `json:"allow_ip_spoofing"` DualStackedPeers bool `json:"dual_stacked_peers"` RealIPHeader string `json:"real_ip_header"` RespectAF bool `json:"respect_af"` SubnetConfig }
NetConfig is the configuration used to tune networking behaviour.
type StatsConfig ¶
type StatsConfig struct { BufferSize int `json:"stats_buffer_size"` IncludeMem bool `json:"include_mem_stats"` VerboseMem bool `json:"verbose_mem_stats"` MemUpdateInterval Duration `json:"mem_stats_interval"` }
StatsConfig is the configuration used to record runtime statistics.
type SubnetConfig ¶
type SubnetConfig struct { PreferredSubnet bool `json:"preferred_subnet,omitempty"` PreferredIPv4Subnet int `json:"preferred_ipv4_subnet,omitempty"` PreferredIPv6Subnet int `json:"preferred_ipv6_subnet,omitempty"` }
SubnetConfig is the configuration used to specify if local peers should be given a preference when responding to an announce.
type TrackerConfig ¶
type TrackerConfig struct { CreateOnAnnounce bool `json:"create_on_announce"` PrivateEnabled bool `json:"private_enabled"` FreeleechEnabled bool `json:"freeleech_enabled"` PurgeInactiveTorrents bool `json:"purge_inactive_torrents"` Announce Duration `json:"announce"` MinAnnounce Duration `json:"min_announce"` NumWantFallback int `json:"default_num_want"` TorrentMapShards int `json:"torrent_map_shards"` NetConfig WhitelistConfig }
TrackerConfig is the configuration for tracker functionality.
type UDPConfig ¶
type UDPConfig struct { UDPListenAddr string `json:"udp_listen_addr"` UDPReadBufferSize int `json:"udp_read_buffer_size"` }
UDPConfig is the configuration for HTTP functionality.
type WhitelistConfig ¶
type WhitelistConfig struct { ClientWhitelistEnabled bool `json:"client_whitelist_enabled"` ClientWhitelist []string `json:"client_whitelist,omitempty"` }
WhitelistConfig is the configuration used enable and store a whitelist of acceptable torrent client peer ID prefixes.