Documentation ¶
Index ¶
- Variables
- type BasicQueryResponse
- type BedrockStatusOptions
- type BedrockStatusResponse
- type Description
- type Favicon
- type FullQueryResponse
- type JavaStatusOptions
- type JavaStatusResponse
- type Packet
- func (p *Packet) ReadAllBytes() ([]byte, error)
- func (p *Packet) ReadBoolean() (bool, error)
- func (p *Packet) ReadByte() (byte, error)
- func (p *Packet) ReadBytes(length int) ([]byte, error)
- func (p *Packet) ReadDouble() (float64, error)
- func (p *Packet) ReadFloat() (float32, error)
- func (p *Packet) ReadInt() (int32, error)
- func (p *Packet) ReadIntLE() (int32, error)
- func (p *Packet) ReadLong() (int64, error)
- func (p *Packet) ReadLongLE() (int64, error)
- func (p *Packet) ReadShort() (int16, error)
- func (p *Packet) ReadShortLE() (int16, error)
- func (p *Packet) ReadString() (string, error)
- func (p *Packet) ReadUnsignedByte() (uint8, error)
- func (p *Packet) ReadUnsignedInt() (uint32, error)
- func (p *Packet) ReadUnsignedIntLE() (uint32, error)
- func (p *Packet) ReadUnsignedLong() (uint64, error)
- func (p *Packet) ReadUnsignedLongLE() (uint64, error)
- func (p *Packet) ReadUnsignedShort() (uint16, error)
- func (p *Packet) ReadUnsignedShortLE() (uint16, error)
- func (p *Packet) ReadVarInt() (int32, error)
- func (p *Packet) ReadVarLong() (int64, error)
- func (p *Packet) WriteBoolean(val bool) error
- func (p *Packet) WriteByte(val byte) error
- func (p *Packet) WriteBytes(val []byte) error
- func (p *Packet) WriteDouble(val float64) error
- func (p *Packet) WriteFloat(val float32) error
- func (p *Packet) WriteInt(val int32) error
- func (p *Packet) WriteIntLE(val int32) error
- func (p *Packet) WriteLength() error
- func (p *Packet) WriteLong(val int64) error
- func (p *Packet) WriteLongLE(val int64) error
- func (p *Packet) WriteShort(val int16) error
- func (p *Packet) WriteShortLE(val int16) error
- func (p *Packet) WriteString(val string) error
- func (p *Packet) WriteTo(w io.Writer) (int64, error)
- func (p *Packet) WriteUnsignedByte(val uint8) error
- func (p *Packet) WriteUnsignedInt(val uint32) error
- func (p *Packet) WriteUnsignedIntLE(val uint32) error
- func (p *Packet) WriteUnsignedLong(val uint64) error
- func (p *Packet) WriteUnsignedLongLE(val uint64) error
- func (p *Packet) WriteUnsignedShort(val uint16) error
- func (p *Packet) WriteUnsignedShortLE(val uint16) error
- func (p *Packet) WriteVarInt(val int32) error
- func (p *Packet) WriteVarLong(val int64) error
- type QueryOptions
- type RCON
- type RCONOptions
- type SRVRecord
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnexpectedResponse means the server sent an unexpected response to the client ErrUnexpectedResponse = errors.New("received an unexpected response from the server") // ErrEmptyBuffer is a generic error for any read methods where the buffer array doesn't contain enough data to read the whole type ErrEmptyBuffer = errors.New("packet does not contain enough data to read this type") // ErrInvalidBoolean means the server sent a value expected as a boolean but the value was neither 0 or 1 ErrInvalidBoolean = errors.New("cannot ReadBoolean() as value is neither 0 or 1") // ErrVarIntTooBig means the server sent a varint which was beyond the protocol size of a varint ErrVarIntTooBig = errors.New("size of VarInt exceeds maximum data size") // ErrNotConnected means the client attempted to send data but there was no connection to the server ErrNotConnected = errors.New("client attempted to send data but connection is non-existent") // ErrAlreadyLoggedIn means the RCON client was already logged in after a second login attempt was made ErrAlreadyLoggedIn = errors.New("RCON client is already logged in after a second login attempt was made") // ErrInvalidPassword means the password used in the RCON loggin was incorrect ErrInvalidPassword = errors.New("incorrect RCON password") // ErrNotLoggedIn ErrNotLoggedIn = errors.New("RCON client attempted to send message before successful login") )
Functions ¶
This section is empty.
Types ¶
type BasicQueryResponse ¶
type BasicQueryResponse struct { MOTD Description GameType string Map string OnlinePlayers uint64 MaxPlayers uint64 HostPort uint16 HostIP string }
func BasicQuery ¶
func BasicQuery(host string, port uint16, options ...QueryOptions) (*BasicQueryResponse, error)
BasicQuery runs a query on the server and returns basic information
type BedrockStatusOptions ¶ added in v1.2.0
type BedrockStatusResponse ¶ added in v1.2.0
type BedrockStatusResponse struct { ServerGUID int64 `json:"server_guid"` Edition string `json:"edition"` MOTDLine1 Description `json:"motd_line_1"` MOTDLine2 Description `json:"motd_line_2"` ProtocolVersion int64 `json:"protocol_version"` Version string `json:"version"` OnlinePlayers int64 `json:"online_players"` MaxPlayers int64 `json:"max_players"` ServerID uint64 `json:"server_id"` Gamemode string `json:"gamemode"` GamemodeID int64 `json:"gamemode_id"` PortIPv4 uint16 `json:"port_ipv4"` PortIPv6 uint16 `json:"port_ipv6"` SRVResult *SRVRecord `json:"srv_result"` }
func StatusBedrock ¶ added in v1.2.0
func StatusBedrock(host string, port uint16, options ...BedrockStatusOptions) (*BedrockStatusResponse, error)
StatusBedrock retrieves the status of a Bedrock Minecraft server
type Description ¶
type Description struct {
// contains filtered or unexported fields
}
Description contains helper functions for reading and writing the description
func (Description) Clean ¶ added in v1.2.0
func (d Description) Clean() string
Clean returns the description with no formatting
func (Description) HTML ¶
func (d Description) HTML() (string, error)
HTML returns the description with HTML formatting
func (Description) Raw ¶
func (d Description) Raw() string
Raw returns the raw description with formatting
func (Description) String ¶
func (d Description) String() string
String returns the description with formatting
type Favicon ¶
type Favicon struct {
// contains filtered or unexported fields
}
Favicon contains helper functions for reading and writing the favicon
func (Favicon) SaveToFile ¶
type FullQueryResponse ¶
func FullQuery ¶
func FullQuery(host string, port uint16, options ...QueryOptions) (*FullQueryResponse, error)
FullQuery runs a query on the server and returns the full information
type JavaStatusOptions ¶ added in v1.2.0
type JavaStatusResponse ¶
type JavaStatusResponse 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"` } `json:"players"` Description Description `json:"description"` Favicon Favicon `json:"favicon"` SRVResult *SRVRecord `json:"srv_result"` }
func Status ¶
func Status(host string, port uint16, options ...JavaStatusOptions) (*JavaStatusResponse, error)
Status retrieves the status of any Minecraft server
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet contains helper functions for reading and writing buffer packets to the TCP stream
func NewPacketFromReader ¶
NewPacketFromReader creates a new packet from the reader