Add A2S query functionality with request and response types
This commit is contained in:
@@ -179,6 +179,29 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
A2SQueryReq {
|
||||
ServerIP string `json:"serverIP"` // Server IP address
|
||||
ServerPort int `json:"serverPort"` // Server port
|
||||
Timeout int `json:"timeout,example=3000,default=3000"` // Timeout in milliseconds (default: 3000ms)
|
||||
}
|
||||
A2SQueryResp {
|
||||
ServerName string `json:"serverName"` // Server name
|
||||
MapName string `json:"mapName"` // Current map name
|
||||
GameDirectory string `json:"gameDirectory"` // Game directory
|
||||
GameDescription string `json:"gameDescription"` // Game description
|
||||
AppID int `json:"appID"` // Steam App ID
|
||||
PlayerCount int `json:"playerCount"` // Current player count
|
||||
MaxPlayers int `json:"maxPlayers"` // Maximum player count
|
||||
BotCount int `json:"botCount"` // Bot count
|
||||
ServerType string `json:"serverType"` // Server type (e.g., "d" for dedicated)
|
||||
Environment string `json:"environment"` // Environment (e.g., "w" for Windows, "l" for Linux)
|
||||
Visibility int `json:"visibility"` // Visibility (0 for public, 1 for private)
|
||||
VAC int `json:"vac"` // VAC status (0 for unsecured, 1 for secured)
|
||||
Version string `json:"version"` // Server version
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: /api/server/statistics
|
||||
)
|
||||
@@ -273,5 +296,12 @@ service ServerStatistics {
|
||||
)
|
||||
@handler topKillerHandler
|
||||
post /top-killer (TopKillerReq) returns (TopKillerResp)
|
||||
|
||||
@doc (
|
||||
summary: "Perform an A2S query to get real-time server information"
|
||||
description: "Perform an A2S query to get real-time server information"
|
||||
)
|
||||
@handler a2sQueryHandler
|
||||
post /a2s-query (A2SQueryReq) returns (A2SQueryResp)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user