Go bindings and interface for the remote console of Hell Let Loose.
- Bindings for all supported RCONv2 operations.
- Proper typing for maps, armaments, squads, and more.
- Event system that expands on the HLL provided logs.
- Support for Lua plugins.
To install the Go package, simply run:
go get github.com/zMoooooritz/go-let-looseWarning
Important API Changes:
- Library update required: Since the official implementation of the legacy RCON protocol got removed, everyone needs to update to the new library version
- Module rename: The
rconv2implementation has been renamed to therconmodule- Users currently using
rconv2will need to update their import paths and code - Users who remained on the original
rconshould experience minimal disruption
- Users currently using
- Unified event system: The event system has been consolidated into the
rconmodule, providing a more elegant, uniform, and easy-to-use interface
Below is an example of how to use the go-let-loose/rcon module in a Go project:
func onKill(e hll.KillEvent) {
fmt.Printf("Kill: %s -> %s (%s)\n", e.Killer.Name, e.Victim.Name, e.Weapon.Name)
}
func main() {
logger.DefaultLogger()
cfg := rcon.ServerConfig{
Host: "123.123.123.123",
Port: "12345",
Password: "password",
}
const workerCount = 10
rcn, err := rcon.NewRcon(cfg, workerCount, rcon.WithCache(), rcon.WithEvents())
if err != nil {
log.Fatal(err)
}
serverName, err := rcn.GetServerName()
if err == nil {
fmt.Printf("Connected to the Server: %s\n", serverName)
} else {
fmt.Println(err)
}
rcn.OnKill(onKill)
time.Sleep(time.Second)
gameState, err := rcn.GetGameState()
if err == nil {
fmt.Printf("Current game state: %+v\n", gameState)
}
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM)
<-sc
rcn.Close()
}To use Lua plugins, place your Lua scripts in the plugins directory. The system will automatically detect and load them.
Example:
function Init()
print("Initializing Plugin")
end
function Run()
local err, name = getServerName()
if name then
print("Connected to the Server: " .. name)
onKill(function(event)
print("Kill: " .. event.Killer.Name .. " -> " .. event.Victim.Name .. " (" .. event.Weapon.Name .. ")")
end)
else
print("Error: " .. err)
end
end
function Stop()
print("Exiting Plugin")
exit()
endFor a more in-depth example, see hello_world.lua.
To run the plugins, use the following command:
go run cmd/go-let-loose-lua/main.goThis project is licensed under the MIT License. You can view the full license here.