From 976a983aa74fd5de6c4ee38835926b8eece3c251 Mon Sep 17 00:00:00 2001 From: Justin Li Date: Wed, 3 Sep 2014 10:18:26 -0400 Subject: [PATCH] go fmt [ci skip] --- config/config.go | 22 +++++++++++----------- http/http.go | 6 +++--- tracker/models/peermap.go | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/config/config.go b/config/config.go index 6aaf703..8d2118d 100644 --- a/config/config.go +++ b/config/config.go @@ -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, diff --git a/http/http.go b/http/http.go index b0b3dd2..c0f177a 100644 --- a/http/http.go +++ b/http/http.go @@ -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, }, } diff --git a/tracker/models/peermap.go b/tracker/models/peermap.go index 4b6fb33..f5167a3 100644 --- a/tracker/models/peermap.go +++ b/tracker/models/peermap.go @@ -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.