Documentation ¶
Index ¶
- Constants
- func WritePacket(writer BufWriter, packet Packet) error
- type BufReadWriter
- type BufReader
- type BufWriter
- type DisconnectPacket
- type HandshakePacket
- type IHandshakePacket
- type LegacyServerListPingPacket
- func (p *LegacyServerListPingPacket) GetHostname() *string
- func (p *LegacyServerListPingPacket) GetPort() *uint16
- func (p *LegacyServerListPingPacket) IsLegacy() bool
- func (p *LegacyServerListPingPacket) ReadFrom(reader BufReader) error
- func (p *LegacyServerListPingPacket) WriteTo(writer BufWriter) error
- type ModernPacket
- type Packet
- type PeekableReader
Constants ¶
View Source
const ( HandShakePacketId = 0x00 // handshake state, C2S DisconnectPacketId = 0x00 // login state, S2C HandshakeNextStateStatus = 1 HandshakeNextStateLogin = 2 )
Variables ¶
This section is empty.
Functions ¶
func WritePacket ¶
Types ¶
type BufReadWriter ¶ added in v0.1.0
type BufReadWriter interface { BufReader PeekableReader BufWriter }
func NewBufferReadWriter ¶ added in v0.1.0
func NewBufferReadWriter(buf io.ReadWriter) BufReadWriter
type BufReader ¶ added in v0.1.0
type BufReader interface { PeekableReader GetReadLen() int Read(n int) ([]byte, error) ReadUInt8() (uint8, error) // Unsigned byte ReadUInt16() (uint16, error) // Unsigned Short ReadInt16() (int16, error) // Short ReadUInt32() (uint32, error) // Unsigned Int ReadInt32() (int32, error) // Int ReadVarInt() (int32, error) ReadString() (string, error) ReadUTF16BE() (string, error) }
type BufWriter ¶ added in v0.1.0
type BufWriter interface { GetWriteLen() int Write(b []byte) error WriteUInt8(value uint8) error // Unsigned byte WriteUInt16(value uint16) error // Unsigned Short WriteInt16(value int16) error // Short WriteUInt32(value uint32) error // Unsigned Int WriteInt32(value int32) error // Int WriteVarInt(value int32) error WriteString(s string) error WriteUTF16BE(s string) error }
type DisconnectPacket ¶
type DisconnectPacket struct {
Reason string
}
DisconnectPacket is in login state, S2C
func (*DisconnectPacket) GetId ¶
func (p *DisconnectPacket) GetId() int32
func (*DisconnectPacket) ReadFrom ¶
func (p *DisconnectPacket) ReadFrom(reader BufReader) error
func (*DisconnectPacket) WriteTo ¶
func (p *DisconnectPacket) WriteTo(writer BufWriter) error
type HandshakePacket ¶
HandshakePacket is in handshake state, C2S
func (*HandshakePacket) GetHostname ¶ added in v0.1.0
func (p *HandshakePacket) GetHostname() *string
func (*HandshakePacket) GetId ¶
func (p *HandshakePacket) GetId() int32
func (*HandshakePacket) GetPort ¶ added in v0.1.0
func (p *HandshakePacket) GetPort() *uint16
func (*HandshakePacket) IsLegacy ¶ added in v0.1.0
func (p *HandshakePacket) IsLegacy() bool
func (*HandshakePacket) ReadFrom ¶
func (p *HandshakePacket) ReadFrom(reader BufReader) error
func (*HandshakePacket) WriteTo ¶
func (p *HandshakePacket) WriteTo(writer BufWriter) error
type IHandshakePacket ¶ added in v0.1.0
func ReadHandshakePacket ¶
func ReadHandshakePacket(reader BufReader) (IHandshakePacket, error)
type LegacyServerListPingPacket ¶ added in v0.1.0
type LegacyServerListPingPacket struct { Header []byte // the first 27 bytes of whatever things. see legacyServerPingHead Protocol uint8 Hostname string Port uint16 }
LegacyServerListPingPacket is in handshake state, C2S see https://wiki.vg/Server_List_Ping#1.6
func (*LegacyServerListPingPacket) GetHostname ¶ added in v0.1.0
func (p *LegacyServerListPingPacket) GetHostname() *string
func (*LegacyServerListPingPacket) GetPort ¶ added in v0.1.0
func (p *LegacyServerListPingPacket) GetPort() *uint16
func (*LegacyServerListPingPacket) IsLegacy ¶ added in v0.1.0
func (p *LegacyServerListPingPacket) IsLegacy() bool
func (*LegacyServerListPingPacket) ReadFrom ¶ added in v0.1.0
func (p *LegacyServerListPingPacket) ReadFrom(reader BufReader) error
func (*LegacyServerListPingPacket) WriteTo ¶ added in v0.1.0
func (p *LegacyServerListPingPacket) WriteTo(writer BufWriter) error
type ModernPacket ¶ added in v0.1.0
func ReadModernPacket ¶ added in v0.1.0
func ReadModernPacket(reader BufReader, packetFactory func(int32) (ModernPacket, error)) (ModernPacket, error)
type PeekableReader ¶ added in v0.1.0
Click to show internal directories.
Click to hide internal directories.