Documentation
¶
Overview ¶
Package net provides tools for creating minecraft servers, such as packet sending, registry data, encryption, authentication, compression and more
Index ¶
- Constants
- Variables
- type Config
- type Conn
- func (conn *Conn) Properties() []login.Property
- func (conn *Conn) PushPacket(pk packet.Encodeable)
- func (conn *Conn) Read(dst []byte) (i int, err error)
- func (conn *Conn) ReadPacket() (decoded packet.Decodeable, interceptionStopped bool, err error)
- func (conn *Conn) SetState(state int32)
- func (conn *Conn) State() int32
- func (conn *Conn) UUID() uuid.UUID
- func (conn *Conn) Username() string
- func (conn *Conn) UsesForge() bool
- func (conn *Conn) Write(data []byte) (i int, err error)
- func (conn *Conn) WritePacket(pk packet.Encodeable) error
- type Listener
- type StatusProvider
Constants ¶
View Source
const ( HandshakingState = iota StatusState LoginState ConfigurationState PlayState )
View Source
const (
ProtocolVersion = 767
)
Variables ¶
View Source
var MaxCompressedPacketSize = 1024 * 1024
1MiB
View Source
var PacketDecodeInterceptor func(c *Conn, pk packet.Decodeable) (stop bool)
View Source
var PacketEncodeInterceptor func(c *Conn, pk packet.Encodeable) (stop bool)
View Source
var PacketWriteInterceptor func(c *Conn, pk *bytes.Buffer, headerSize int32) (stop bool)
View Source
var ServerboundPool = map[int32]map[int32]func() packet.Decodeable{ HandshakingState: { 0x00: func() packet.Decodeable { return &handshake.Handshaking{} }, }, StatusState: { 0x00: func() packet.Decodeable { return &status.StatusRequest{} }, 0x01: func() packet.Decodeable { return &status.Ping{} }, }, LoginState: { 0x00: func() packet.Decodeable { return &login.LoginStart{} }, 0x02: func() packet.Decodeable { return &login.LoginPluginResponse{} }, 0x01: func() packet.Decodeable { return &login.EncryptionResponse{} }, 0x03: func() packet.Decodeable { return &login.LoginAcknowledged{} }, 0x04: func() packet.Decodeable { return &login.CookieResponse{} }, }, ConfigurationState: { 0x00: func() packet.Decodeable { return &configuration.ClientInformation{} }, 0x01: func() packet.Decodeable { return &configuration.CookieResponse{} }, 0x02: func() packet.Decodeable { return &configuration.ServerboundPluginMessage{} }, 0x03: func() packet.Decodeable { return &configuration.AcknowledgeFinishConfiguration{} }, 0x04: func() packet.Decodeable { return &configuration.KeepAlive{} }, 0x05: func() packet.Decodeable { return &configuration.Pong{} }, }, PlayState: { 0x00: func() packet.Decodeable { return &play.ConfirmTeleportation{} }, 0x04: func() packet.Decodeable { return &play.ChatCommand{} }, 0x05: func() packet.Decodeable { return &play.SignedChatCommand{} }, 0x06: func() packet.Decodeable { return &play.ChatMessage{} }, 0x08: func() packet.Decodeable { return &play.ChunkBatchReceived{} }, 0x07: func() packet.Decodeable { return &play.PlayerSession{} }, 0x0A: func() packet.Decodeable { return &play.ClientInformation{} }, 0x0E: func() packet.Decodeable { return &play.ClickContainer{} }, 0x0F: func() packet.Decodeable { return &play.CloseContainer{} }, 0x12: func() packet.Decodeable { return &play.ServerboundPluginMessage{} }, 0x16: func() packet.Decodeable { return &play.Interact{} }, 0x18: func() packet.Decodeable { return &play.ServerboundKeepAlive{} }, 0x1A: func() packet.Decodeable { return &play.SetPlayerPosition{} }, 0x1B: func() packet.Decodeable { return &play.SetPlayerPositionAndRotation{} }, 0x1C: func() packet.Decodeable { return &play.SetPlayerRotation{} }, 0x1D: func() packet.Decodeable { return &play.SetPlayerOnGround{} }, 0x23: func() packet.Decodeable { return &play.PlayerAbilitiesServerbound{} }, 0x25: func() packet.Decodeable { return &play.PlayerCommand{} }, 0x2F: func() packet.Decodeable { return &play.SetHeldItemServerbound{} }, 0x32: func() packet.Decodeable { return &play.SetCreativeModeSlot{} }, 0x36: func() packet.Decodeable { return &play.SwingArm{} }, 0x38: func() packet.Decodeable { return &play.UseItemOn{} }, }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Conn ¶
func (*Conn) Properties ¶
func (*Conn) PushPacket ¶
func (conn *Conn) PushPacket(pk packet.Encodeable)
PushPacket adds a packet to the queue without waiting for it to be sent
func (*Conn) ReadPacket ¶
func (conn *Conn) ReadPacket() (decoded packet.Decodeable, interceptionStopped bool, err error)
func (*Conn) WritePacket ¶
func (conn *Conn) WritePacket(pk packet.Encodeable) error
type Listener ¶
type Listener struct {
net.Listener
ApprovePlayer func(*Conn) (ok bool, disconnectionReason *text.TextComponent)
// contains filtered or unexported fields
}
func (*Listener) SetStatusProvider ¶
func (l *Listener) SetStatusProvider(p StatusProvider)
func (*Listener) StatusProvider ¶
func (l *Listener) StatusProvider() StatusProvider
type StatusProvider ¶
type StatusProvider func(*Conn) status.StatusResponseData
func Status ¶
func Status(s status.StatusResponseData) StatusProvider
Source Files
¶
Click to show internal directories.
Click to hide internal directories.