torrent/peer_protocol/pex.go

27 lines
693 B
Go
Raw Normal View History

2018-07-10 01:21:24 +00:00
package peer_protocol
2019-08-10 08:46:07 +00:00
import "github.com/anacrolix/dht/v2/krpc"
2018-07-10 01:21:24 +00:00
type PexMsg struct {
Added krpc.CompactIPv4NodeAddrs `bencode:"added"`
AddedFlags []PexPeerFlags `bencode:"added.f"`
Added6 krpc.CompactIPv6NodeAddrs `bencode:"added6"`
Added6Flags []PexPeerFlags `bencode:"added6.f"`
Dropped krpc.CompactIPv4NodeAddrs `bencode:"dropped"`
Dropped6 krpc.CompactIPv6NodeAddrs `bencode:"dropped6"`
}
type PexPeerFlags byte
func (me PexPeerFlags) Get(f PexPeerFlags) bool {
return me&f == f
}
const (
PexPrefersEncryption = 0x01
PexSeedUploadOnly = 0x02
PexSupportsUtp = 0x04
PexHolepunchSupport = 0x08
PexOutgoingConn = 0x10
)