Documentation
¶
Index ¶
Constants ¶
const ( UsEast1 = "us-east-1" EuCentral = "eu-central-1" ApSoutheast = "ap-southeast-1" ApEast = "ap-east-1" )
Region represents dst lobby server region, it may be updated by klei in the future
const ( LobbyRegionURL = `https://lobby-v2-cdn.klei.com/regioncapabilities-v2.json` LobbyServersURL = `https://lobby-v2-cdn.klei.com/{{.region}}-{{.platform}}.json.gz` LobbyDetailsURL = "https://lobby-v2-{{.region}}.klei.com/lobby/read" )
Lobby server urls, may be updated by klei in the future
const GameId = "DontStarveTogether"
Variables ¶
var ExplicitPlatforms = []string{Steam.String(), PSN.String(), Rail.String(), XBOne.String(), Switch.String()}
ExplicitPlatforms means that platforms could be used as query params in klei api.
Functions ¶
func PlatformDisplayName ¶ added in v1.3.0
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is dst lobby http client, interact with lobby server and returns server information
func (*Client) GetCapableRegions ¶
GetCapableRegions returns a list of available regions that can be used in other api GET https://lobby-v2-cdn.klei.com/regioncapabilities-v2.json
func (*Client) GetLobbyServers ¶
GetLobbyServers returns a list of lobby servers with specified region and platform GET https://lobby-v2-cdn.klei.com/{region}-{platform}.json.gz
func (*Client) GetServerDetails ¶
func (c *Client) GetServerDetails(region string, rowId string) (ServerDetails, error)
GetServerDetails returns the details information for the specified server by rowId POST https://lobby-v2-{region}.klei.com/lobby/read
type Platform ¶
type Platform uint
Platform represents dst server platform, it may be updated by klei in the future
type Regions ¶
type Regions struct { Regions []struct { Region string `json:"Region"` } `json:"LobbyRegions"` }
type Secondaries ¶
type Secondaries struct { Id string `json:"id"` SteamId string `json:"steamid"` Address string `json:"__addr"` Port int `json:"port"` }
Secondaries represents the secondaries shard among dst servers
type Server ¶
type Server struct { // network options Guid string `json:"guid"` RowId string `json:"__rowId"` // only at steam platform SteamId string `json:"steamid"` // only for clan server SteamClanId string `json:"steamclanid"` // only for no password server OwnerNetId string `json:"ownernetid"` SteamRoom string `json:"steamroom"` Session string `json:"session"` Address string `json:"__addr"` Port int `json:"port"` Host string `json:"host"` Platform Platform `json:"platform"` ClanOnly bool `json:"clanonly"` LanOnly bool `json:"lanonly"` // second shard Secondaries map[string]Secondaries // game options Name string `json:"name"` GameMode string `json:"mode"` Intent string `json:"intent"` Season string `json:"season"` TagStr string `json:"tags"` Version int `json:"v"` // max players allowed MaxConnections int `json:"maxconnections"` // online players number Connected int `json:"connected"` Mod bool `json:"mods"` Pvp bool `json:"pvp"` HasPassword bool `json:"password"` IsDedicated bool `json:"dedicated"` ClientHosted bool `json:"clienthosted"` AllowNewPlayers bool `json:"allownewplayers"` ServerPaused bool `json:"serverpaused"` FriendOnly bool `json:"fo"` // processed info Region string `json:"region"` Tags []string `json:"tag_arr"` }
Server includes all the information about single dst server
type ServerDetails ¶
type ServerDetails struct { // repeat options Server Tick int `json:"tick"` ClientModsOff bool `json:"clientmodsoff"` Nat int `json:"nat"` // raw lua script data Data string `json:"data"` WorldGen string `json:"worldgen"` OnlinePlayers string `json:"players"` Mods []any `json:"mods_info"` // parsed lua data Details MetaInfo `json:"details"` }
ServerDetails includes some details information