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 ¶
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 Details ¶
type Details struct {
Day int `bson:"day" json:"day"`
DayElapsedInSeason int `bson:"day_elapsed_in_season" json:"dayElapsedInSeason"`
DaysLeftInSeason int `bson:"days_left_in_season" json:"daysLeftInSeason"`
Players []Player `bson:"players" json:"playerList"`
Mods []Mod `bson:"mods" json:"modList"`
}
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" bson:"id"`
SteamId string `json:"steamid" bson:"steam_id"`
Address string `json:"__addr" bson:"address"`
Port int `json:"port" bson:"port"`
}
Secondaries represents the secondaries shard among dst servers
type Server ¶
type Server struct {
// network options
Guid string `json:"guid" bson:"guid"`
RowId string `json:"__rowId" bson:"row_id"`
// only at steam platform
SteamId string `json:"steamid" bson:"steam_id"`
// only for clan server
SteamClanId string `json:"steamclanid" bson:"steam_clan_id"`
// only for no password server
OwnerNetId string `json:"ownernetid" bson:"owner_net_id"`
SteamRoom string `json:"steamroom" bson:"steam_room"`
Session string `json:"session" bson:"session"`
Address string `json:"__addr" bson:"address"`
Port int `json:"port" bson:"port"`
Host string `json:"host" bson:"host"`
Platform Platform `json:"platform" bson:"platform"`
ClanOnly bool `json:"clanonly" bson:"clan_only"`
LanOnly bool `json:"lanonly" bson:"lan_only"`
// second shard
Secondaries map[string]Secondaries `bson:"secondaries"`
// game options
Name string `json:"name" bson:"name"`
GameMode string `json:"mode" bson:"game_mode"`
Intent string `json:"intent" bson:"intent"`
Season string `json:"season" bson:"season"`
Tags string `json:"tags" bson:"-"`
Version int `json:"v" bson:"version"`
// max players allowed
MaxConnections int `json:"maxconnections" bson:"max_connections"`
// online players number
Connected int `json:"connected" bson:"connected"`
ModEnabled bool `json:"mods" bson:"mod_enabled"`
PvpEnabled bool `json:"pvp" bson:"pvp_enabled"`
HasPassword bool `json:"password" bson:"has_password"`
IsDedicated bool `json:"dedicated" bson:"is_dedicated"`
ClientHosted bool `json:"clienthosted" bson:"client_hosted"`
AllowNewPlayers bool `json:"allownewplayers" bson:"allow_new_players"`
ServerPaused bool `json:"serverpaused" bson:"server_paused"`
FriendOnly bool `json:"fo" bson:"friend_only"`
}
Server includes all the information about single dst server
type ServerDetails ¶
type ServerDetails struct {
// repeat options
Server
Tick int `json:"tick" bson:"tick"`
ClientModsOff bool `json:"clientmodsoff" bson:"client_mods_off"`
Nat int `json:"nat" bson:"nat"`
// raw lua script data
Data string `json:"data" bson:"data"`
WorldGen string `json:"worldgen" bson:"world_gen"`
OnlinePlayers string `json:"players" bson:"online_players"`
Mods []any `json:"mods_info" bson:"mods"`
// parsed lua data
Details Details `bson:"details"`
}
ServerDetails includes some details information