servers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DDNetHTTPMasterUrl = "https://master1.ddnet.org/ddnet/15/servers.json"

Allows to change this url

Functions

This section is empty.

Types

type Client

type Client struct {
	Name     string `json:"name"`
	Clan     string `json:"clan"`
	Country  int16  `json:"country"`
	Score    int32  `json:"score"`
	IsPlayer bool   `json:"is_player"`
	Skin     *Skin  `json:"skin,omitempty"`
	Afk      *bool  `json:"afk,omitempty"`
	Team     *int16 `json:"team,omitempty"`
}

func (*Client) IsPlayerInt64

func (c *Client) IsPlayerInt64() int64

type ClientScoreKind

type ClientScoreKind string
const (
	Points ClientScoreKind = "points"
	Time   ClientScoreKind = "time"
)

type Info

type Info struct {
	Name            string           `json:"name"`
	GameType        string           `json:"game_type"`
	Map             Map              `json:"map"`
	Version         string           `json:"version"`
	Passworded      bool             `json:"passworded"`
	MaxClients      int16            `json:"max_clients"`
	MaxPlayers      int16            `json:"max_players"`
	Clients         []Client         `json:"clients,omitempty"`
	ClientScoreKind *ClientScoreKind `json:"client_score_kind,omitempty"`
	ServerSignature *string          `json:"server_signature,omitempty"`
	AltamedaNet     *bool            `json:"altameda_net,omitempty"`
}

type Location

type Location string

type Map

type Map struct {
	Name   string  `json:"name"`
	Sha256 *string `json:"sha256,omitempty"`
	Size   *int32  `json:"size,omitempty"`
}

type Part

type Part struct {
	Name  string `json:"name"`
	Color *int32 `json:"color,omitempty"`
}

type Server

type Server struct {
	Addresses []string  `json:"addresses"`
	Location  *Location `json:"location,omitempty"`
	Info      Info      `json:"info"`
}

func GetAllServers

func GetAllServers() ([]Server, error)

func GetServers

func GetServers(url string) ([]Server, error)

type ServerList

type ServerList struct {
	Servers []Server `json:"servers"`
}

type Skin

type Skin struct {
	Name       *string `json:"name,omitempty"`
	ColorBody  *int32  `json:"color_body,omitempty"`
	ColorFeet  *int32  `json:"color_feet,omitempty"`
	Body       *Part   `json:"body,omitempty"`
	Marking    *Part   `json:"marking,omitempty"`
	Decoration *Part   `json:"decoration,omitempty"`
	Hands      *Part   `json:"hands,omitempty"`
	Feet       *Part   `json:"feet,omitempty"`
	Eyes       *Part   `json:"eyes,omitempty"`
}

Jump to

Keyboard shortcuts

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