A golang BattlEye client libary
Перейти к файлу
Steven Hartland 5c3fa7b6ea Remove tip from travis builds and test on latest 1.x
Remove tip from the travis builds as its now the same as master and set to test on the latest 1.x version.
2017-12-01 12:34:50 +00:00
.gitignore Initial commit 2017-09-21 14:39:20 +01:00
.travis.yml Remove tip from travis builds and test on latest 1.x 2017-12-01 12:34:50 +00:00
LICENSE Initial commit 2017-09-21 14:39:20 +01:00
README.md Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
client.go Fixed client sequence number race 2017-10-12 14:44:01 +01:00
client_config_options.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
client_test.go Fixed client sequence number race 2017-10-12 14:44:01 +01:00
consts.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
done.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
done_test.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
errors.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
integration_test.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
mockserver_test.go Fixed client sequence number race 2017-10-12 14:44:01 +01:00
packet.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
packet_test.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
parser.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00
parser_test.go Initial version of BattlEye RCON client 2017-10-12 09:54:34 +01:00

README.md

BattlEye Go Report Card License GoDoc Build Status

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.