protocol

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(conn io.ReadWriter) *Handler

func (*Handler) HandlePingPong

func (h *Handler) HandlePingPong() error

func (*Handler) OrigBytes

func (h *Handler) OrigBytes() []byte

func (*Handler) ReadHandshake

func (h *Handler) ReadHandshake() (*Handshake, error)

func (*Handler) ReadStatusRequest

func (h *Handler) ReadStatusRequest() error

func (*Handler) WriteStatus

func (h *Handler) WriteStatus(status Status) error

type Handshake

type Handshake struct {
	ProtocolHdr
	Version    int
	ServerAddr string
	ServerPort int
	NextState  int
}

type ProtocolHdr

type ProtocolHdr struct {
	Length   int
	PacketID int
}

type Status

type Status struct {
	Version struct {
		Name     string `json:"name"`
		Protocol int    `json:"protocol"`
	} `json:"version"`
	Players struct {
		Max    int `json:"max"`
		Online int `json:"online"`
		Sample []struct {
			Name string `json:"name"`
			ID   string `json:"id"`
		} `json:"sample,omitempty"`
	} `json:"players"`
	Description struct {
		Text string `json:"text"`
	} `json:"description"`
	Favicon            *string `json:"favicon,omitempty"`
	EnforcesSecureChat bool    `json:"enforcesSecureChat"`
	PreviewsChat       *bool   `json:"prviewsChat"`
	CustomData         any     `json:"x-premises,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL