Documentation ¶
Index ¶
- Constants
- Variables
- func AvatarURI(db *store.DB, userID ID) string
- func FindSteamPaths(rel ...string) []string
- func MustReadGameImageURI(id ID, kind GameImageKind) string
- func OpenAvatar(db *store.DB, userID ID) (fs.File, error)
- func QueryServerInfo(db *store.DB, maxAge time.Duration, region Region, addr string) (ServerInfo, *ServerReply, error)
- func QueryServerList(db *store.DB, maxAge time.Duration, gameID ID) (map[string]Region, error)
- func ReadGameImage(id ID, kind GameImageKind) (mime string, _ []byte, _ error)
- func ReadVDF[T any](fn string) (v T, err error)
- type GameImageKind
- type GameInfo
- type ID
- type LibFS
- type LocalAppConfig
- type LocalConfig
- type MasterQuery
- type MasterReply
- type PakDirEntry
- type PakFS
- type PakFile
- type Profile
- type Region
- type ServerInfo
- type ServerQuery
- type ServerReply
- type User
Constants ¶
View Source
const (
SourceMasterServerAddr = "hl2master.steampowered.com:27011"
)
Variables ¶
View Source
var ( GamesList = []*GameInfo{ MustInitGameInfo(GameInfo{ ID: 1012110, Title: "Military Conflict - Vietnam", MapImageDir: "materials/panorama/images/map_icons/playmenu", BgVideoFn: "panorama/videos/background.webm", PakDir: "vietnam", PakPfx: "vietnam/pak01", }), } GamesMap = func() map[ID]*GameInfo { m := map[ID]*GameInfo{} for _, g := range GamesList { m[g.ID] = g } return m }() GamesMapString = func() map[string]*GameInfo { m := map[string]*GameInfo{} for _, g := range GamesList { m[g.ID.String()] = g } return m }() )
View Source
var ( ErrNoServers = errors.New("No servers found") ErrChallenge = errors.New("Challenge") ErrUnknownPrefix = errors.New("Unknown Prefix") ErrUnknownHeader = errors.New("Unknown Header") )
View Source
var (
Logs = logs.AppLogger()
)
Functions ¶
func FindSteamPaths ¶
func MustReadGameImageURI ¶
func MustReadGameImageURI(id ID, kind GameImageKind) string
func QueryServerInfo ¶
func QueryServerInfo(db *store.DB, maxAge time.Duration, region Region, addr string) (ServerInfo, *ServerReply, error)
func QueryServerList ¶
func ReadGameImage ¶
func ReadGameImage(id ID, kind GameImageKind) (mime string, _ []byte, _ error)
Types ¶
type GameImageKind ¶
type GameImageKind string
const ( IconImage GameImageKind = "icon" HeroImage GameImageKind = "library_hero" )
type GameInfo ¶
type GameInfo struct { ID ID `json:"id"` Title string `json:"title"` DirName string `json:"dirName"` IconURI string `json:"iconURI"` HeroURI string `json:"heroURI"` MapImageDir string MapImageURL string `json:"mapImageURL"` BgVideoURL string `json:"bgVideoURL"` MapNames []string `json:"mapNames"` MapImageURLs []string `json:"mapImageURLs"` BgVideoFn string PakDir string PakPfx string }
func MustInitGameInfo ¶
func (*GameInfo) ReadMapNames ¶
type LibFS ¶
func FindSteamLibs ¶
func FindSteamLibs() []*LibFS
type LocalAppConfig ¶
type LocalAppConfig struct {
LaunchOptions string
}
type LocalConfig ¶
type LocalConfig struct {
Apps map[ID]LocalAppConfig
}
func ReadLocalConfig ¶
func ReadLocalConfig(userID ID) (LocalConfig, error)
type MasterQuery ¶
type MasterReply ¶
type MasterReply struct { Region Region // contains filtered or unexported fields }
func (*MasterReply) ID ¶
func (mr *MasterReply) ID() netip.Addr
func (*MasterReply) Port ¶
func (mr *MasterReply) Port() int
func (*MasterReply) String ¶
func (mr *MasterReply) String() string
type PakDirEntry ¶
func (*PakDirEntry) IsDir ¶
func (p *PakDirEntry) IsDir() bool
func (*PakDirEntry) Name ¶
func (p *PakDirEntry) Name() string
func (*PakDirEntry) Type ¶
func (p *PakDirEntry) Type() fs.FileMode
type Profile ¶
type ServerInfo ¶
type ServerInfo struct { Addr string `json:"addr"` Name string `json:"name"` Players int `json:"players"` Bots int `json:"bots"` Restricted bool `json:"restricted"` PingMs int `json:"ping"` Map string `json:"map"` Game string `json:"game"` MaxPlayers int `json:"maxPlayers"` Region Region `json:"region"` Country string `json:"country"` Ts time.Time `json:"ts"` }
type ServerQuery ¶
type ServerReply ¶
type ServerReply struct { // Always equal to 'I' (0x49) Header byte // Protocol version used by the server. Protocol byte // Name of the server. Name string // Map the server has currently loaded. Map string // Name of the folder containing the game files. Folder string // Full name of the game. Game string // Steam Application ID of game. ID int16 // Number of players on the server. Players byte // Maximum number of players the server reports it can hold. MaxPlayers byte // Number of bots on the server. Bots byte // Indicates the type of server: // 'd' for a dedicated server // 'l' for a non-dedicated server // 'p' for a SourceTV relay (proxy) ServerType byte // Indicates the operating system of the server: // 'l' for Linux // 'w' for Windows // 'm' or 'o' for Mac (the code changed after L4D1) Environment byte // Indicates whether the server requires a password: // 0 for public // 1 for private Visibility byte // Specifies whether the server uses VAC: // 0 for unsecured // 1 for secured VAC byte Ping time.Duration Challenge int32 Ts time.Time }
Click to show internal directories.
Click to hide internal directories.