Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownPacketType = errors.New("unknown packet type")
Functions ¶
This section is empty.
Types ¶
type InfoRequestPacket ¶
type InfoRequestPacket struct{}
InfoRequestPacket represents the structure of the packet used to request info from a bootstrap node. It contains infoRequestPacketLength - 1 useless bytes.
func (InfoRequestPacket) ID ¶
func (p InfoRequestPacket) ID() PacketType
ID returns the packet ID of this packet.
func (*InfoRequestPacket) MarshalBinary ¶
func (p *InfoRequestPacket) MarshalBinary() ([]byte, error)
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*InfoRequestPacket) UnmarshalBinary ¶
func (p *InfoRequestPacket) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
type InfoResponsePacket ¶
InfoResponsePacket represents the structure of a packet that is sent in response to a bootstrap node info request.
func (InfoResponsePacket) ID ¶
func (p InfoResponsePacket) ID() PacketType
ID returns the packet ID of this packet.
func (*InfoResponsePacket) MarshalBinary ¶
func (p *InfoResponsePacket) MarshalBinary() ([]byte, error)
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*InfoResponsePacket) UnmarshalBinary ¶
func (p *InfoResponsePacket) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
type Packet ¶
type Packet interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler ID() PacketType }
func UnmarshalBinary ¶
func UnmarshalPacket ¶
type PacketType ¶
type PacketType byte
const (
PacketTypeBootstrapInfo PacketType = 0xF0
)
func (PacketType) String ¶
func (t PacketType) String() string
type RawPacket ¶
type RawPacket struct { Type PacketType Payload []byte }
RawPacket represents the base of all bootstrap node packets.
func MarshalPacket ¶
func (*RawPacket) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*RawPacket) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.