5c3fa7b6ea
Remove tip from the travis builds as its now the same as master and set to test on the latest 1.x version. |
||
---|---|---|
.gitignore | ||
.travis.yml | ||
LICENSE | ||
README.md | ||
client.go | ||
client_config_options.go | ||
client_test.go | ||
consts.go | ||
done.go | ||
done_test.go | ||
errors.go | ||
integration_test.go | ||
mockserver_test.go | ||
packet.go | ||
packet_test.go | ||
parser.go | ||
parser_test.go |
README.md
BattlEye
go-battleye is a Go client for the BattlEye RCON Protocol.
Features
- Full BattlEye RCON support.
- Multi-packet response support.
- Auto keep-alive support.
Installation
go get -u github.com/multiplay/go-battleye
Examples
Using go-battleye is simple, just create a client then execute commands e.g.
package main
import (
"log"
battleye "github.com/multiplay/go-battleye"
)
func main() {
c, err := battleye.NewClient("192.168.1.102:2301", "mypass")
if err != nil {
log.Fatal(err)
}
defer c.Close()
resp, err := c.Exec("version")
if err != nil {
log.Fatal(err)
}
log.Println("server version:", resp)
}
Server broadcast messages arrive in a buffered read-only channel. By default, there is room for
100 messages. You can get more by using the MessageBuffer
option in the client constructor:
battleye.NewClient("192.168.1.102:2301", "mypass", battleye.MessageBuffer(500))
If the channel gets full, new messages will be dropped. It is your responsibility to drain the channel, e.g.:
func LogServerMessages(c *battleye.Client) {
for {
switch {
case msg := <-c.Messages():
log.Println(msg)
// Another case to exit the for loop.
// ...
}
}
}
Run integration test using your own BattlEye server:
go test -v -tags=integration -run=Integration -address=<BattlEye server address> -password=<admin password>
Documentation
License
go-battleye is available under the BSD 2-Clause License.