bootstrap

package
v0.0.0-...-9721c62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2024 License: GPL-3.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

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

type InfoResponsePacket struct {
	Version uint32
	MOTD    string
}

InfoResponsePacket represents the structure of a packet that is sent in response to a bootstrap node info request.

func (InfoResponsePacket) ID

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

func UnmarshalBinary

func UnmarshalBinary(data []byte) (Packet, error)

func UnmarshalPacket

func UnmarshalPacket(p *RawPacket) (Packet, error)

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 MarshalPacket(packet Packet) (*RawPacket, error)

func (*RawPacket) MarshalBinary

func (p *RawPacket) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*RawPacket) UnmarshalBinary

func (p *RawPacket) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL