Documentation ¶
Index ¶
- Constants
- Variables
- type Extension
- type Message
- func (opts Message) Copy() Message
- func (opts Message) I2PPEX() bool
- func (opts Message) IsSupported(ext string) (has bool)
- func (opts Message) LNPEX() bool
- func (opts Message) Lookup(id uint8) (string, bool)
- func (opts Message) MetaData() bool
- func (opts *Message) SetSupported(ext Extension)
- func (opts Message) ToWireMessage() common.WireMessage
- func (opts Message) XDHT() bool
- type MetaData
Constants ¶
const I2PDHT = Extension("i2p_dht")
bittorrent extension for i2p's dht variant
const I2PPeerExchange = Extension("i2p_pex")
I2PPeerExchange is a BitTorrent Extension indicating we support PEX variant for i2p
const LokinetPeerExchange = Extension("ln_pex")
LokinetPeerExchange is a Bittorrent Extension indication we support Lokinet PEX
const UTData = 1
UTData msg_type for data
const UTMetaData = Extension("ut_metadata")
UTMetaData is the bittorrent extension for ut_metadata
const UTReject = 2
UTReject msg_type for reject messages
const UTRequest = 0
UTRequest msg_type for requests
const XDHT = Extension("xdht")
bittorrent extension for XD's dht variant over wire protocol
Variables ¶
var ErrInvalidMessageID = errors.New("invalid message id")
var ErrInvalidSize = errors.New("invalid message size")
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { ID uint8 `bencode:"-"` Version string `bencode:"v"` // handshake data Extensions map[string]uint32 `bencode:"m"` // handshake data Payload interface{} `bencode:"-"` PayloadRaw []byte `bencode:"-"` MetainfoSize *uint32 `bencode:"metadata_size,omitempty"` }
Message is a serializable BitTorrent extended options message
func FromWireMessage ¶
func FromWireMessage(msg common.WireMessage) (opts Message, err error)
FromWireMessage loads an ExtendedOptions messgae from a BitTorrent wire message
func (Message) IsSupported ¶
IsSupported returns true if an extension by its name is supported
func (*Message) SetSupported ¶
SetSupported sets a bittorrent extension as supported
func (Message) ToWireMessage ¶
func (opts Message) ToWireMessage() common.WireMessage
ToWireMessage serializes this ExtendedOptions to a BitTorrent wire message