client

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoKeySpecified = errors.New("no secret key was specified")
	ErrNon2XXResponse = errors.New("received non 2XX status code")
	ErrNotImplemented = errors.New("not implemented")
)

Functions

func DecodeSecretKey

func DecodeSecretKey(key string) ([]byte, error)

Decode and return the secret key.

func GetDate

func GetDate() (string, error)

Returns the current date and time in RFC1123 format.

func GetHMAC

func GetHMAC(key []byte, url string, nonce int, date string) (string, error)

Compute and return the HMAC hash for the given key, URL, nonce, and date.

func GetNonce

func GetNonce() (int, error)

Generates and returns a random number to be used as a nonce for a request.

Types

type AsteroidResponse

type AsteroidResponse struct {
	BaseResponse
	Data struct {
		Asteroids []AsteroidResponseData `json:"Asteroids"`
	} `json:"data"`
}

type AsteroidResponseData

type AsteroidResponseData struct {
	DisplayName string         `json:"DisplayName"`
	EntityId    int64          `json:"EntityId"`
	Position    EntityPosition `json:"Position"`
}

type BannedPlayersResponse

type BannedPlayersResponse struct {
	BaseResponse
	Data struct {
		BannedPlayers []PlayerResponseData `json:"BannedPlayers"`
	} `json:"data"`
}

type BaseResponse

type BaseResponse struct {
	Meta struct {
		ApiVersion string  `json:"apiVersion"`
		QueryTime  float64 `json:"queryTime"`
	} `json:"meta"`
}

type CheaterResponseData

type CheaterResponseData struct {
	Explanation    string `json:"Explanation"`
	Id             int    `json:"Id"`
	Name           string `json:"Name"`
	PlayerId       uint64 `json:"PlayerId"`
	ServerDateTime string `json:"ServerDateTime"`
}

type CheatersResponse

type CheatersResponse struct {
	BaseResponse
	Data struct {
		Cheaters []CheaterResponseData `json:"Cheaters"`
	} `json:"data"`
}

type EntityPosition

type EntityPosition struct {
	X float64 `json:"X"`
	Y float64 `json:"Y"`
	Z float64 `json:"Z"`
}

type FloatingObjectsResponse added in v0.1.1

type FloatingObjectsResponse struct {
	BaseResponse
	Data struct {
		FloatingObjects []interface{} `json:"FloatingObjects"`
	} `json:"data"`
}

type GridResponse

type GridResponse struct {
	BaseResponse
	Data struct {
		Grids []GridResponseData `json:"Grids"`
	} `json:"data"`
}

type GridResponseData

type GridResponseData struct {
	DisplayName      string         `json:"DisplayName"`
	EntityId         int64          `json:"EntityId"`
	GridSize         string         `json:"GridSize"`
	BlocksCount      uint           `json:"BlocksCount"`
	Mass             float64        `json:"Mass"`
	Position         EntityPosition `json:"Position"`
	LinearSpeed      float64        `json:"LinearSpeed"`
	DistanceToPlayer float64        `json:"DistanceToPlayer"`
	OwnerSteamId     uint64         `json:"OwnerSteamId"`
	OwnerDisplayName string         `json:"OwnerDisplayName"`
	IsPowered        bool           `json:"IsPowered"`
	PCU              uint           `json:"PCU"`
}

type KickedPlayersResponse

type KickedPlayersResponse struct {
	BaseResponse
	Data struct {
		KickedPlayers []PlayerResponseData `json:"KickedPlayers"`
	} `json:"data"`
}

type PingResponse

type PingResponse struct {
	BaseResponse
	Data PingResponseData `json:"data"`
}

type PingResponseData

type PingResponseData struct {
	Result string `json:"Result"`
}

type PlanetResponse

type PlanetResponse struct {
	BaseResponse
	Data struct {
		Planets []PlanetResponseData `json:"Planets"`
	} `json:"data"`
}

type PlanetResponseData

type PlanetResponseData struct {
	DisplayName string         `json:"DisplayName"`
	EntityId    int64          `json:"EntityId"`
	Position    EntityPosition `json:"Position"`
}

type PlayerResponseData

type PlayerResponseData struct {
	SteamID     uint64 `json:"SteamID"`
	DisplayName string `json:"DisplayName"`
}

type ServerResponse

type ServerResponse struct {
	BaseResponse
	Data ServerResponseData `json:"data"`
}

type ServerResponseData

type ServerResponseData struct {
	IsReady           bool    `json:"IsReady"`
	PirateUsedPCU     uint    `json:"PirateUsedPCU"`
	Players           int     `json:"Players"`
	ServerId          uint64  `json:"ServerId"`
	ServerName        string  `json:"ServerName"`
	SimSpeed          float64 `json:"SimSpeed"`
	SimulationCpuLoad float64 `json:"SimulationCpuLoad"`
	TotalTime         uint    `json:"TotalTime"`
	UsedPCU           uint    `json:"UsedPCU"`
	Version           string  `json:"Version"`
	WorldName         string  `json:"WorldName"`
}

type VRageClient

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

func NewVRageClient

func NewVRageClient(api string, keyFile string, key string, sslVerify bool, logger *log.Logger) (*VRageClient, error)

Create and return a new VRage client.

Returns an error if the key is not able to be loaded from the specified key file.

func (*VRageClient) GetAsteroids

func (c *VRageClient) GetAsteroids() (*AsteroidResponse, error)

Retrieve the list of asteroids from the server.

func (*VRageClient) GetBannedPlayers

func (c *VRageClient) GetBannedPlayers() (*BannedPlayersResponse, error)

Retrieve the list of banned players.

func (*VRageClient) GetCheaters

func (c *VRageClient) GetCheaters() (*CheatersResponse, error)

Retrieve the list of cheaters.

func (*VRageClient) GetFloatingObjects added in v0.1.1

func (c *VRageClient) GetFloatingObjects() (*FloatingObjectsResponse, error)

Retrieve the list of floating objects.

func (*VRageClient) GetGrids

func (c *VRageClient) GetGrids() (*GridResponse, error)

Retrieve the list of grids from the server.

func (*VRageClient) GetKickedPlayers

func (c *VRageClient) GetKickedPlayers() (*KickedPlayersResponse, error)

Retrieve the list of kicked players.

func (*VRageClient) GetPlanets

func (c *VRageClient) GetPlanets() (*PlanetResponse, error)

Retrieve the list of planets from the server.

func (*VRageClient) GetServerDetails

func (c *VRageClient) GetServerDetails() (*ServerResponse, error)

Collect and return the server details.

func (*VRageClient) Ping

func (c *VRageClient) Ping() (bool, error)

Pings the server and returns true if we received a pong, false otherwise.

func (*VRageClient) Request

func (c *VRageClient) Request(path string, method string) ([]byte, error)

Make a request to the remote API and return the response data.

Jump to

Keyboard shortcuts

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