From 289293f3cc0cfd03bbe3bf168dcc1ba6a90d13aa Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 17 Oct 2019 17:46:35 +1100 Subject: [PATCH] Rename peer source constants --- Peer.go | 2 +- client.go | 2 +- connection.go | 6 +++--- torrent.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Peer.go b/Peer.go index 5f63e6ed..6a017330 100644 --- a/Peer.go +++ b/Peer.go @@ -21,7 +21,7 @@ type Peer struct { func (me *Peer) FromPex(na krpc.NodeAddr, fs peer_protocol.PexPeerFlags) { me.IP = append([]byte(nil), na.IP...) me.Port = na.Port - me.Source = peerSourcePEX + me.Source = peerSourcePex // If they prefer encryption, they must support it. if fs.Get(peer_protocol.PexPrefersEncryption) { me.SupportsEncryption = true diff --git a/client.go b/client.go index f5b4adae..d10750e3 100644 --- a/client.go +++ b/client.go @@ -1254,7 +1254,7 @@ func (cl *Client) onDHTAnnouncePeer(ih metainfo.Hash, ip net.IP, port int, portO t.addPeers([]Peer{{ IP: ip, Port: port, - Source: peerSourceDHTAnnouncePeer, + Source: peerSourceDhtAnnouncePeer, }}) } diff --git a/connection.go b/connection.go index cb240826..8e415a50 100644 --- a/connection.go +++ b/connection.go @@ -31,9 +31,9 @@ type peerSource string const ( peerSourceTracker = "Tr" peerSourceIncoming = "I" - peerSourceDHTGetPeers = "Hg" // Peers we found by searching a DHT. - peerSourceDHTAnnouncePeer = "Ha" // Peers that were announced to us by a DHT. - peerSourcePEX = "X" + peerSourceDhtGetPeers = "Hg" // Peers we found by searching a DHT. + peerSourceDhtAnnouncePeer = "Ha" // Peers that were announced to us by a DHT. + peerSourcePex = "X" ) // Maintains the state of a connection with a peer. diff --git a/torrent.go b/torrent.go index 838011c4..917367e8 100644 --- a/torrent.go +++ b/torrent.go @@ -1341,7 +1341,7 @@ func (t *Torrent) consumeDhtAnnouncePeers(pvs <-chan dht.PeersValues) { t.addPeer(Peer{ IP: cp.IP[:], Port: cp.Port, - Source: peerSourceDHTGetPeers, + Source: peerSourceDhtGetPeers, }) } cl.unlock() -- 2.48.1