Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( SrUsEastCoast SrvRegion = []byte{0x00} SrUsWestCoast SrvRegion = []byte{0x01} SrSouthAmerica SrvRegion = []byte{0x02} SrEurope SrvRegion = []byte{0x03} SrAsia SrvRegion = []byte{0x04} SrAustralia SrvRegion = []byte{0x05} SrMiddleEast SrvRegion = []byte{0x06} SrAfrica SrvRegion = []byte{0x07} SrAll SrvRegion = []byte{0xFF} // --------------------- "Constant" filters --------------------- // Dedicated servers SfDedicated SrvFilter = []byte("\\dedicated\\1") // Servers using anti-cheat technology (VAC, but maybe others as well) SfSecure SrvFilter = []byte("\\secure\\1") // Servers running on a Linux platform SfLinux SrvFilter = []byte("\\linux\\1") // Servers that are not empty SfNotEmpty SrvFilter = []byte("\\empty\\1") // Servers that are not full SfNotFull SrvFilter = []byte("\\full\\1") // Servers that spectator proxies SfSpectatorProxy SrvFilter = []byte("\\proxy\\1") // Servers that are empty SfEmpty SrvFilter = []byte("\\noplayers\\1") // Servers that are whitelisted SfWhitelisted SrvFilter = []byte("\\white\\1") // Return only one server for each unique IP address matched SfOneUniquePerIP SrvFilter = []byte("\\collapse_addr_hash\\1") // ALL servers SfAll SrvFilter = []byte{0x00} // ----------------Filters the take variable input ---------------- // \appid\[appid] - Servers that are running game [appid] AppIDFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\appid\\%s", val)) } // \gameaddr\[ip]Return only servers on the specified IP address // (port supported and optional) GameAddrFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\gameaddr\\%s", val)) } // \gamedata\[tag,...] - Servers with all of the given tag(s) in their //'hidden' tags (L4D2) GameDataFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\gamedata\\%s", val)) } // \gamedataor\[tag,...] - Servers with any of the given tag(s) in their // 'hidden' tags (L4D2) GameDataOrFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\gamedataor\\%s", val)) } // \gamedir\[mod] - Servers running the specified modification (ex. cstrike) GameDirFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\gamedir\\%s", val)) } // \gametype\[tag,...] - Servers with all of the given tag(s) in sv_tags GameTypeFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\gametype\\%s", val)) } // \name_match\[hostname] - Servers with their hostname matching [hostname] // (can use * as a wildcard) NameMatchFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\name_match\\%s", val)) } // \nand\[x] - A special filter, specifies that servers matching all of the // following [x] conditions should not be returned NAndFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\nand\\%s", val)) } // \nor\[x] - A special filter, specifies that servers matching any of the //following [x] conditions should not be returned NOrFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\nor\\%s", val)) } // \napp\[appid] - Servers that are NOT running game [appid] // (This was introduced to block Left 4 Dead games from the Steam Server Browser NAppIDFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\nappid\\%s", val)) } // \map\[map] - Servers running the specified map (ex. cs_italy) MapFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\map\\%s", val)) } // \version_match\[version] - Servers running version [version] // (can use * as a wildcard) VersionMatchFilter = func(val string) SrvFilter { return []byte(fmt.Sprintf("\\version_match\\%s", val)) } )
Regions and filters
var ( // GameAlienSwarm Alien Swarm GameAlienSwarm = Game{ Name: "AlienSwarm", AppID: 630, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameARMA3 ARMA 3 GameARMA3 = Game{ Name: "ARMA3", AppID: 107410, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameARKSurvivalEvolved ARK: Survival Evolved GameARKSurvivalEvolved = Game{ Name: "ARKSurvivalEvolved", AppID: 346110, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameCsGo Counter-Strike: GO GameCsGo = Game{ Name: "CSGO", AppID: 730, IgnoreRules: true, IgnorePlayers: false, IgnoreInfo: false, } // GameCSSource Counter-Strike: Source GameCSSource = Game{ Name: "CSSource", AppID: 240, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameDayZ DayZ GameDayZ = Game{ Name: "DayZ", AppID: 221100, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameGarrysMod Garry's Mod GameGarrysMod = Game{ Name: "GarrysMod", AppID: 4000, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameHL2DM Half-Life 2: Deathmatch GameHL2DM = Game{ Name: "HL2DM", AppID: 320, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameL4D2 Left 4 Dead 2 GameL4D2 = Game{ Name: "L4D2", AppID: 550, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameOpposingForce Half-Life: Opposing Force GameOpposingForce = Game{ Name: "OpposingForce", AppID: 50, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameQuakeLive Quake Live GameQuakeLive = Game{ Name: "QuakeLive", AppID: 282440, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameReflex Reflex GameReflex = Game{ Name: "Reflex", AppID: 328070, IgnoreRules: true, IgnorePlayers: false, IgnoreInfo: false, } // GameRust Rust GameRust = Game{ Name: "Rust", AppID: 252490, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameTF2 Team Fortress 2 GameTF2 = Game{ Name: "TF2", AppID: 440, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } // GameUnspecified Unspecified game for direct server queries, if enabled; // if unspecified games actually ignore some A2S requests there will be issues. // This is intentionally left out of the defaultGames GameList struct so it //is not user-selectable in the configuration creation. GameUnspecified = Game{ Name: "Unspecified", AppID: 0, IgnoreRules: false, IgnorePlayers: false, IgnoreInfo: false, } )
A few default games, additional games can be added from https://steamdb.info/apps/
Functions ¶
func DumpDefaultGames ¶
func DumpDefaultGames()
DumpDefaultGames writes the default struct containing the default games to disk on success, otherwise panics.
func GetGameNames ¶
func GetGameNames() []string
GetGameNames returns a slice of strings containing the games' names.
func HasHighServerCount ¶
HasHighServerCount determines if the specified game is in the list of games that are known to return more than 6930 servers, which is the value at which Valve begins to throttle future responses from the master server.
func IsValidGame ¶
IsValidGame determines whether the specified game exists within the list of games and returns true if it does, otherwise false.
Types ¶
type Filter ¶
Filter is our internal wrapper for a specified game, and its Master server region code and Master server filters
type Game ¶
type Game struct { Name string `json:"name"` AppID uint64 `json:"appID"` // Some games (i.e. newer/beta ones) do not have all 3 of A2S_INFO,PLAYER,RULES // any of these ignore values set to true will skip that request when querying IgnoreRules bool `json:"ignoreRules"` IgnorePlayers bool `json:"ignorePlayers"` IgnoreInfo bool `json:"ignoreInfo"` }
Game represents a queryable Steam game, including its application ID and whether particular A2S requests need to be ignored when querying.
func GetGameByAppID ¶
GetGameByAppID searches the list of pre-defined games and returns a Game struct based on the AppID of the game.
func GetGameByName ¶
GetGameByName searches the list of pre-defined games and returns a a Game struct based on the name of the game.
func NewGame ¶
NewGame specifies a new game, including its name, Steam application-ID, and whether A2S_RULES, A2S_PLAYERS, and/or AS2_INFO requests should be ignored when performing a query.