mirror of
https://git.phc.dm.unipi.it/aziis98/go-stats-server.git
synced 2026-10-06 20:34:51 +00:00
09a6b8374fb19583d196c245664f1d6494f46037
Go Stats Server
This Go project implements a simple TCP server that responds to custom commands over the network. The server performs various system-related tasks and provides information such as CPU usage, memory status, network statistics, storage details, and system uptime.
Usage
-
Build the Server:
CGO_ENABLED=0 GOARCH=<arch> go build -a -ldflags '-s -w' -o ./out/stats-server main.go -
Run the Server:
./out/stats-server -
Connect to the Server: Use a TCP client to connect to the server on port 12345. You can send commands like "cpu," "memory," "network," "storage," "uptime," and "exit."
Example using
nc:echo "cpu" | nc localhost 12345or using golang
import "net" func main() { conn, err := net.Dial("tcp", "localhost:12345") if err != nil { // handle error } defer conn.Close() conn.Write([]byte("cpu")) }
GitHub Actions Workflow
The included GitHub Actions workflow automates the build and release process. On each push to the main branch, the workflow builds the Go program, creates a GitHub release, and uploads the compiled binary as an artifact.
Downloading the Artifact
TODO
Languages
Go
100%