Documentation
¶
Index ¶
- type Conn
- func (c *Conn) Close()
- func (c *Conn) EnableEncryption(sharedSecret []byte) error
- func (c *Conn) ForwardPacket(pb PacketBuffer) (err error)
- func (c *Conn) GetNonce() []byte
- func (c *Conn) GetState() packet.State
- func (c *Conn) ReadLoop()
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SendPacket(pkt packet.Packet) (err error)
- func (c *Conn) SetState(state packet.State)
- type PacketBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
A Conn represents a connection to a Minecraft server or client. It wraps the underlying net.Conn and provides utilities for processing and writing packets.
func (*Conn) EnableEncryption ¶
func (*Conn) ForwardPacket ¶
func (c *Conn) ForwardPacket(pb PacketBuffer) (err error)
func (*Conn) RemoteAddr ¶
type PacketBuffer ¶
type PacketBuffer struct {
Id int // The protocol ID of the packet
// contains filtered or unexported fields
}
PacketBuffer represents a buffer containing a single packet. Does not hold the connection state, the state can be inferred from the connection which created the buffer.
Packet buffers must be fully consumed. If not reading the content, the Consume method should be called. Forwarding a packet buffer to another connection does count as consumption.
func (PacketBuffer) Consume ¶
func (p PacketBuffer) Consume()
Consume marks the packet as read without using the data