Rcon
Source RCON Protocol implementation in Go.
Install / Use
/learn @gorcon/RconREADME
Rcon
Source RCON Protocol implementation in Go.
Protocol Specifications
RCON Protocol described in the valve documentation.
Supported Games
Works for any game using the Source RCON Protocol. Tested on:
- Project Zomboid
- Conan Exiles
- Rust (add +rcon.web 0 to the args when starting the server)
- ARK: Survival Evolved
- Counter-Strike: Global Offensive
- Minecraft
- Palworld
- Factorio (start the server with
--rcon-bind/--rcon-portand--rcon-passwordargs)
Open pull request if you have successfully used a package with another game with rcon support and add it to the list.
Install
go get github.com/gorcon/rcon
See Changelog for release details.
Usage
package main
import (
"fmt"
"log"
"github.com/gorcon/rcon"
)
func main() {
conn, err := rcon.Dial("127.0.0.1:16260", "password")
if err != nil {
log.Fatal(err)
}
defer conn.Close()
response, err := conn.Execute("help")
if err != nil {
log.Fatal(err)
}
fmt.Println(response)
}
With an existing net.Conn
If you wish to initialize a RCON connection with an already initialized net.Conn, you can use the Open function:
package main
import (
"fmt"
"log"
"net"
"github.com/gorcon/rcon"
)
func main() {
netConn, err := net.Dial("tcp", "127.0.0.1:16260")
if err != nil {
// Failed to open TCP connection to the server.
log.Fatalf("expected nil got error: %s", err)
}
defer netConn.Close()
conn, err := rcon.Open(netConn, "password")
if err != nil {
log.Fatal(err)
}
defer conn.Close()
response, err := conn.Execute("help")
if err != nil {
log.Fatal(err)
}
fmt.Println(response)
}
Requirements
Go 1.15 or higher
Contribute
Contributions are more than welcome!
If you think that you have found a bug, create an issue and publish the minimum amount of code triggering the bug, so it can be reproduced.
If you want to fix the bug then you can create a pull request. If possible, write a test that will cover this bug.
License
MIT License, see LICENSE
Related Skills
node-connect
337.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
337.4kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
83.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
