Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Handshake = NewRegistry(HandshakeState) Status = NewRegistry(StatusState) Login = NewRegistry(LoginState) Play = NewRegistry(PlayState) )
The registries storing the packets for a connection state.
Functions ¶
This section is empty.
Types ¶
type PacketRegistry ¶
type PacketRegistry struct { Direction proto.Direction // The direction the registered packets are send to. Protocols map[proto.Protocol]*ProtocolRegistry // The protocol versions. // Whether to fallback to the minimum protocol version // in case a protocol could not be found. Fallback bool }
PacketRegistry stores packets protocol versions sent to server or client.
func NewPacketRegistry ¶
func NewPacketRegistry(direction proto.Direction) *PacketRegistry
func (*PacketRegistry) ProtocolRegistry ¶
func (p *PacketRegistry) ProtocolRegistry(protocol proto.Protocol) *ProtocolRegistry
ProtocolRegistry gets the ProtocolRegistry for a protocol.
func (*PacketRegistry) Register ¶
func (p *PacketRegistry) Register(packetOf proto.Packet, mappings ...*PacketMapping)
type ProtocolRegistry ¶
type ProtocolRegistry struct { Protocol proto.Protocol // The protocol version of the registered packets. PacketIds map[proto.PacketId]proto.PacketType // Gets packet type by packet id. PacketTypes map[proto.PacketType]proto.PacketId // Gets packet id by packet type. }
ProtocolRegistry stores packets of a protocol version.
func FromDirection ¶
func (*ProtocolRegistry) CreatePacket ¶
func (r *ProtocolRegistry) CreatePacket(id proto.PacketId) proto.Packet
CreatePacket returns a new zero valued instance of the type of the mapped packet id or nil if not found.
type Registry ¶
type Registry struct { proto.State ServerBound *PacketRegistry ClientBound *PacketRegistry }
Registry stores server/client bound packets.
func NewRegistry ¶
Click to show internal directories.
Click to hide internal directories.