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