mcclient

package
v0.0.0-...-aa68bd4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mcclient is a generated GoMock package.

Index

Constants

View Source
const (
	// ClientStateUnknown is the default state
	ClientStateUnknown = 0
	// ClientStateStatus is for sending unauthenticated ping and status messages
	ClientStateStatus = 1
	// ClientStateLogin is for authenticating with the client
	ClientStateLogin = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientState

type ClientState int

ClientState represents the connection state of the client

type Handshake

type Handshake struct {
	Version client.VarInt
	Address client.VarString
	Port    uint16
	State   client.VarInt
}

Handshake represents the opening handshake with the server

func (*Handshake) DecodeBinary

func (hnd *Handshake) DecodeBinary(reader io.Reader) error

DecodeBinary decodes the handshake from the binary format on the wire

func (Handshake) EncodeBinary

func (hnd Handshake) EncodeBinary(writer io.Writer) error

EncodeBinary encodes the handshake in the binary format for the wire

type MinecraftClient

type MinecraftClient interface {
	Handshake(ClientState) error
	Status() (*StatusResponse, error)
	Close() error
}

MinecraftClient represents a client connection to a Minecraft server

func NewMinecraftClient

func NewMinecraftClient(client client.Client) (MinecraftClient, error)

NewMinecraftClient wraps an existing client connection as a MinecraftClient

func NewMinecraftClientFromAddress

func NewMinecraftClientFromAddress(address string) (MinecraftClient, error)

NewMinecraftClientFromAddress creates a new client connection with a Minecraft server

type MockMinecraftClient

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

MockMinecraftClient is a mock of MinecraftClient interface

func NewMockMinecraftClient

func NewMockMinecraftClient(ctrl *gomock.Controller) *MockMinecraftClient

NewMockMinecraftClient creates a new mock instance

func (*MockMinecraftClient) Close

func (m *MockMinecraftClient) Close() error

Close mocks base method

func (*MockMinecraftClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMinecraftClient) Handshake

func (m *MockMinecraftClient) Handshake(arg0 ClientState) error

Handshake mocks base method

func (*MockMinecraftClient) Status

func (m *MockMinecraftClient) Status() (*StatusResponse, error)

Status mocks base method

type MockMinecraftClientMockRecorder

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

MockMinecraftClientMockRecorder is the mock recorder for MockMinecraftClient

func (*MockMinecraftClientMockRecorder) Close

Close indicates an expected call of Close

func (*MockMinecraftClientMockRecorder) Handshake

func (mr *MockMinecraftClientMockRecorder) Handshake(arg0 interface{}) *gomock.Call

Handshake indicates an expected call of Handshake

func (*MockMinecraftClientMockRecorder) Status

Status indicates an expected call of Status

type StatusDescription

type StatusDescription struct {
	Text string `json:"text" firestore:"text"`
}

StatusDescription represents the message of the day reported by the server

type StatusPlayers

type StatusPlayers struct {
	Max    int    `json:"max" firestore:"max"`
	Online int    `json:"online" firestore:"online"`
	Users  []User `json:"sample" firestore:"users"`
}

StatusPlayers represents the players logged in to the server

type StatusResponse

type StatusResponse struct {
	Version     StatusVersion     `json:"version" firestore:"version"`
	Players     StatusPlayers     `json:"players" firestore:"players"`
	Description StatusDescription `json:"description" firestore:"description"`
	Favicon     string            `json:"favicon" firestore:"favicon"`
}

StatusResponse is the response to a status request to the server

type StatusVersion

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

StatusVersion represents the server version

type User

type User struct {
	Name string `json:"name" firestore:"name"`
	UUID string `json:"id" firestore:"uuid"`
}

User represents a minecraft user

Jump to

Keyboard shortcuts

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