go fmt [ci skip]
This commit is contained in:
parent
67df033c7f
commit
976a983aa7
|
@ -70,12 +70,12 @@ type Config struct {
|
||||||
FreeleechEnabled bool `json:"freeleech_enabled"`
|
FreeleechEnabled bool `json:"freeleech_enabled"`
|
||||||
PurgeInactiveTorrents bool `json:"purge_inactive_torrents"`
|
PurgeInactiveTorrents bool `json:"purge_inactive_torrents"`
|
||||||
|
|
||||||
Announce Duration `json:"announce"`
|
Announce Duration `json:"announce"`
|
||||||
MinAnnounce Duration `json:"min_announce"`
|
MinAnnounce Duration `json:"min_announce"`
|
||||||
RequestTimeout Duration `json:"request_timeout"`
|
RequestTimeout Duration `json:"request_timeout"`
|
||||||
HttpReadTimeout Duration `json:"http_read_timeout"`
|
HttpReadTimeout Duration `json:"http_read_timeout"`
|
||||||
HttpWriteTimeout Duration `json:"http_write_timeout"`
|
HttpWriteTimeout Duration `json:"http_write_timeout"`
|
||||||
NumWantFallback int `json:"default_num_want"`
|
NumWantFallback int `json:"default_num_want"`
|
||||||
|
|
||||||
ClientWhitelistEnabled bool `json:"client_whitelist_enabled"`
|
ClientWhitelistEnabled bool `json:"client_whitelist_enabled"`
|
||||||
ClientWhitelist []string `json:"client_whitelist,omitempty"`
|
ClientWhitelist []string `json:"client_whitelist,omitempty"`
|
||||||
|
@ -100,12 +100,12 @@ var DefaultConfig = Config{
|
||||||
FreeleechEnabled: false,
|
FreeleechEnabled: false,
|
||||||
PurgeInactiveTorrents: true,
|
PurgeInactiveTorrents: true,
|
||||||
|
|
||||||
Announce: Duration{30 * time.Minute},
|
Announce: Duration{30 * time.Minute},
|
||||||
MinAnnounce: Duration{15 * time.Minute},
|
MinAnnounce: Duration{15 * time.Minute},
|
||||||
RequestTimeout: Duration{10 * time.Second},
|
RequestTimeout: Duration{10 * time.Second},
|
||||||
HttpReadTimeout: Duration{10 * time.Second},
|
HttpReadTimeout: Duration{10 * time.Second},
|
||||||
HttpWriteTimeout: Duration{10 * time.Second},
|
HttpWriteTimeout: Duration{10 * time.Second},
|
||||||
NumWantFallback: 50,
|
NumWantFallback: 50,
|
||||||
|
|
||||||
StatsConfig: StatsConfig{
|
StatsConfig: StatsConfig{
|
||||||
BufferSize: 0,
|
BufferSize: 0,
|
||||||
|
@ -118,7 +118,7 @@ var DefaultConfig = Config{
|
||||||
NetConfig: NetConfig{
|
NetConfig: NetConfig{
|
||||||
AllowIPSpoofing: true,
|
AllowIPSpoofing: true,
|
||||||
DualStackedPeers: true,
|
DualStackedPeers: true,
|
||||||
RespectAF: false,
|
RespectAF: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
ClientWhitelistEnabled: false,
|
ClientWhitelistEnabled: false,
|
||||||
|
|
|
@ -122,9 +122,9 @@ func Serve(cfg *config.Config, tkr *tracker.Tracker) {
|
||||||
Timeout: cfg.RequestTimeout.Duration,
|
Timeout: cfg.RequestTimeout.Duration,
|
||||||
ConnState: srv.connState,
|
ConnState: srv.connState,
|
||||||
Server: &http.Server{
|
Server: &http.Server{
|
||||||
Addr: cfg.Addr,
|
Addr: cfg.Addr,
|
||||||
Handler: newRouter(srv),
|
Handler: newRouter(srv),
|
||||||
ReadTimeout: cfg.HttpReadTimeout.Duration,
|
ReadTimeout: cfg.HttpReadTimeout.Duration,
|
||||||
WriteTimeout: cfg.HttpWriteTimeout.Duration,
|
WriteTimeout: cfg.HttpWriteTimeout.Duration,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,19 +179,19 @@ func (pm *PeerMap) AppendSubnetPeers(ipv4s, ipv6s PeerList, ann *Announce, wante
|
||||||
|
|
||||||
// Optionally Respect AF for peers returned and avoid copy-pasta
|
// Optionally Respect AF for peers returned and avoid copy-pasta
|
||||||
func appendPeers(ipv4s, ipv6s *PeerList, ann *Announce, peer *Peer, count *int) {
|
func appendPeers(ipv4s, ipv6s *PeerList, ann *Announce, peer *Peer, count *int) {
|
||||||
// v6 to only v6 announcements
|
// v6 to only v6 announcements
|
||||||
if ann.HasIPv6() && peer.HasIPv6() {
|
if ann.HasIPv6() && peer.HasIPv6() {
|
||||||
*ipv6s = append(*ipv6s, *peer)
|
*ipv6s = append(*ipv6s, *peer)
|
||||||
*count++
|
*count++
|
||||||
// v4 to only dual stacked requests if we are respecting AF of annoucement
|
// v4 to only dual stacked requests if we are respecting AF of annoucement
|
||||||
} else if ann.Config.RespectAF && ann.HasIPv4() && peer.HasIPv4() {
|
} else if ann.Config.RespectAF && ann.HasIPv4() && peer.HasIPv4() {
|
||||||
*ipv4s = append(*ipv4s, *peer)
|
*ipv4s = append(*ipv4s, *peer)
|
||||||
*count++
|
*count++
|
||||||
// Default everything else to get IPv4 if we are not respecting AF
|
// Default everything else to get IPv4 if we are not respecting AF
|
||||||
} else if !ann.Config.RespectAF && peer.HasIPv4() {
|
} else if !ann.Config.RespectAF && peer.HasIPv4() {
|
||||||
*ipv4s = append(*ipv4s, *peer)
|
*ipv4s = append(*ipv4s, *peer)
|
||||||
*count++
|
*count++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// peersEquivalent checks if two peers represent the same entity.
|
// peersEquivalent checks if two peers represent the same entity.
|
||||||
|
|
Loading…
Reference in a new issue