https://github.com/rumblefrog/go-a2s
Golang implementation of Source Query
https://github.com/rumblefrog/go-a2s
Last synced: 4 months ago
JSON representation
Golang implementation of Source Query
- Host: GitHub
- URL: https://github.com/rumblefrog/go-a2s
- Owner: rumblefrog
- License: mit
- Created: 2018-10-05T02:25:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-06-29T19:46:11.000Z (11 months ago)
- Last Synced: 2025-10-14T22:26:46.516Z (8 months ago)
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 71
- Watchers: 3
- Forks: 18
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Go A2S
> As the underlying A2S protocol seldoms ever have changes, this library will not have any changes either, rather than an indication of unmaintained.
[](https://goreportcard.com/report/github.com/rumblefrog/go-a2s)
[](https://godoc.org/github.com/rumblefrog/go-a2s)
An implementation of [Source A2S Queries](https://developer.valvesoftware.com/wiki/Server_queries)
Godoc is available here: https://godoc.org/github.com/rumblefrog/go-a2s
**Note: Only supports Source engine and above, Goldsource is not supported**
## Guides
### Installing
```bash
go get -u github.com/rumblefrog/go-a2s
```
### Querying
```go
package main
import (
"github.com/rumblefrog/go-a2s"
)
func main() {
client, err := a2s.NewClient("ServerIP:Port")
if err != nil {
// Handle error
}
defer client.Close()
info, err := client.QueryInfo() // QueryInfo, QueryPlayer, QueryRules
if err != nil {
// Handle error
}
// ...
}
```
### Setting client options
```go
package main
import (
"github.com/rumblefrog/go-a2s"
)
func main() {
client, err := a2s.NewClient(
"ServerIP:Port",
a2s.SetMaxPacketSize(14000), // Some engine does not follow the protocol spec, and may require bigger packet buffer
a2s.TimeoutOption(time.Second * 5), // Setting timeout option. Default is 3 seconds
// ... Other options
)
if err != nil {
// Handle error
}
defer client.Close()
// ...
}
```
## Credits
- Dvander's Blaster for the packet logics
- xPaw's PHP Source Query for query specific logics