minecraftgo

package module
v0.0.0-...-3d8bbc7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(m interface{}) []byte

func Ping

func Ping(ip *net.TCPAddr) ([]byte, error)

func Unmarshal

func Unmarshal(data io.Reader, out interface{})

Unmarshal is a wrapper for unmarshal

Types

type APIAuthResponse

type APIAuthResponse struct {
	User              APIUser      `json:"user"`
	ClientToken       string       `json:"clientToken"`
	AccessToken       string       `json:"accessToken"`
	AvailableProfiles []APIProfile `json:"availableProfiles"`
	SelectedProfile   APIProfile   `json:"selectedProfile"`
}

type APIProfile

type APIProfile struct {
	Name string `json:"name"` // Username
	ID   string `json:"id"`   // Hex UUID
}

type APIProperty

type APIProperty struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type APIUser

type APIUser struct {
	Username   string        `json:"username"`
	Properties []APIProperty `json:"properties"`
	ID         string        `json:"id"` // Remote ID
}

type CompressedData

type CompressedData struct {
	PacketID VarInt
}

type CompressedPacket

type CompressedPacket struct {
	PacketLength VarInt
	DataLength   VarInt
}

type Conn

type Conn struct {
	TCP                  *net.TCPConn
	Compressed           bool
	Encrypted            bool
	AuthResp             APIAuthResponse
	Cipher               cipher.Stream
	CompressionThreshold int
}

func Connect

func Connect(ip *net.TCPAddr, username string, email string, password string) (*Conn, error)

func (*Conn) Listener

func (c *Conn) Listener()

func (*Conn) Read

func (c *Conn) Read(buf []byte) (n int, err error)

type EncryptionRequest

type EncryptionRequest struct {
	ServerID          String
	PubKeyLength      VarInt
	PubKey            []byte
	VerifyTokenLength VarInt
	VerifyToken       []byte
}

Not used - for reference only

type EncryptionResponse

type EncryptionResponse struct {
	SharedSecretLen VarInt
	SharedSecret    []byte
	VerifyTokenLen  VarInt
	VerifyToken     []byte
}

type Handshake

type Handshake struct {
	Version VarInt
	Address String
	Port    uint16
	Next    VarInt
}

CLIENT

type LoginStart

type LoginStart struct {
	Username String
}

CLIENT

type PingMod

type PingMod struct {
	ModID   string `json:"modid"`
	Version string `json:"version"`
}

type PingModInfo

type PingModInfo struct {
	Type    string    `json:"type"`
	ModList []PingMod `json:"modList"`
}

type PingPlayer

type PingPlayer struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type PingPlayers

type PingPlayers struct {
	Max    int          `json:"max"`
	Online int          `json:"online"`
	Sample []PingPlayer `json:"sample"`
}

type PingResponse

type PingResponse struct {
	Description PingText        `json:"description"`
	Players     PingPlayers     `json:"players"`
	Version     PingVersionInfo `json:"version"`
	Favicon     string          `json:"favicon"`
	ModInfo     PingModInfo     `json:"modinfo,omitempty"`
}

SERVER

type PingText

type PingText struct {
	Text string `json:"text"`
}

type PingVersionInfo

type PingVersionInfo struct {
	Name     string `json:"name"`
	Protocol int    `json:"protocol"`
}

type PluginMessage

type PluginMessage struct {
	Namespace String
	Data      []byte
}

type SetCompression

type SetCompression struct {
	Threshold VarInt
}

type String

type String string

func (*String) Deserialize

func (s *String) Deserialize(data io.Reader)

Returns the rest of the data that has not been read

func (String) Serialize

func (s String) Serialize() []byte

type UncompressedPacket

type UncompressedPacket struct {
	Length   VarInt
	PacketID VarInt
}

type VarInt

type VarInt int

func (*VarInt) Deserialize

func (v *VarInt) Deserialize(data io.Reader)

Returns the rest of the data that has not been read

func (VarInt) Serialize

func (v VarInt) Serialize() []byte

Jump to

Keyboard shortcuts

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