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