add: rcon implementation

This commit is contained in:
2026-02-12 18:59:15 -08:00
commit 7c1697660f
7 changed files with 436 additions and 0 deletions

25
README.md Normal file
View File

@@ -0,0 +1,25 @@
# MC god
Minecraft (MC) god is a tool that connects to a Minecraft server's RCON port, listens for messages from users by tailing the log, and interacts with players. It has the ability to call some functions to control things like weather, day/night cycle, and difficulty.
## Layout
This repository uses the Go standard layout described at https://github.com/golang-standards/project-layout.
- internal/pkg
- rcon -- contains utilities for interacting with the RCON service
- cmd/mcgod -- contains the main function
### RCON
https://github.com/gorcon/rcon is used to connect to the RCON. The system expects the user provide a RCON_ADDRESS, and RCON_PASSWORD environment flag.
# Handling updates
Use `go mod tidy` to update go.mod; do not directly modify it.
# Best practices
## Only capture environment/flags in main
To make testing easier, all utility packages should accept arguments that they need. These arguments sometimes get provided by the user, via flags or environment variables. Such variables should generally only be captured in the top-level package (i.e., main), and not helpers.