proto

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChallengeMalformed = errors.New("challenge malformed")
	ErrChallengeMismatch  = errors.New("challenge mismatch")
	ErrNoChallenge        = errors.New("no challenge")
)

Functions

func WireWrite

func WireWrite(resp *bytes.Buffer, w WireEncoder, data interface{}) error

WireWrite writes the provided data to resp with the provided WireEncoder w.

Types

type QueryBase added in v0.3.0

type QueryBase struct {
	State *QueryState
	// contains filtered or unexported fields
}

QueryBase is the base querying struct which can be used by other implementers to handle features such as challenge generation.

func (*QueryBase) ChallengeMatchesForClient added in v0.3.0

func (q *QueryBase) ChallengeMatchesForClient(clientAddress string, challenge uint32) error

ChallengeMatchesForClient determines whether the challenge value supplied by the client matches what is stored by this server.

func (*QueryBase) GenerateChallenge added in v0.3.0

func (q *QueryBase) GenerateChallenge(clientAddress string) (uint32, error)

GenerateChallenge generates a challenge value for the calling client address. If stale challenges have not been purged for a while, this is done asynchronously.

type QueryResponder

type QueryResponder interface {
	Respond(clientAddress string, buf []byte) ([]byte, error)
}

QueryResponder represents an interface to a concrete type which responds to query requests.

type QueryState

type QueryState struct {
	CurrentPlayers int32
	MaxPlayers     int32
	ServerName     string
	GameType       string
	Map            string
	Port           uint16
	Metrics        []float32
}

QueryState represents the state of a currently running game.

type WireEncoder

type WireEncoder interface {
	WriteString(resp *bytes.Buffer, s string) error
	Write(resp *bytes.Buffer, v interface{}) error
}

WireEncoder is an interface which allows for different query implementations to write data to a byte buffer in a specific format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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