Documentation
¶
Index ¶
Constants ¶
View Source
const MaxPacket = 1 << 21
Variables ¶
This section is empty.
Functions ¶
func VarIntSize ¶
VarIntSize returns the number of bytes n takes up
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes packet headers and returns the payload
func NewDecoder ¶
func (*Decoder) DecodePacket ¶
DecodePacket reads from the underlying reader and returns a packet's payload. The slice returned is valid until the next call.
func (*Decoder) EnableDecompression ¶
func (dec *Decoder) EnableDecompression()
EnableDecompression Enables zlib decompression
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder writes packet payload with the header
func NewEncoder ¶
func (*Encoder) EnableCompression ¶
func (*Encoder) EnableEncryption ¶
func (*Encoder) EncodePacket ¶
type PlayerListUpdateAction ¶
type PlayerListUpdateAction byte
const ( AddPlayer PlayerListUpdateAction = 1 << iota InitializeChat UpdateGameMode UpdateListed UpdateLatency UpdateDisplayName )
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps bufio.Reader and adds decryption functionality.
func (*Reader) Next ¶
Next returns the next n bytes in the buffer and advances the reader. If n is bigger than the buffer then it returns bufio.ErrBufferFull without data and won't advance the reader.
func (*Reader) ReadVarInt ¶
Click to show internal directories.
Click to hide internal directories.