6 "github.com/anacrolix/dht/krpc"
7 "github.com/anacrolix/torrent/peer_protocol"
15 // Peer is known to support encryption.
16 SupportsEncryption bool
17 peer_protocol.PexPeerFlags
20 func (me *Peer) FromPex(na krpc.NodeAddr, fs peer_protocol.PexPeerFlags) {
21 me.IP = append([]byte(nil), na.IP...)
23 me.Source = peerSourcePEX
24 // If they prefer encryption, they must support it.
25 if fs.Get(peer_protocol.PexPrefersEncryption) {
26 me.SupportsEncryption = true
31 func (me Peer) addr() ipPort {
32 return ipPort{me.IP, uint16(me.Port)}