Adopt repo standards: scaffold, policies, lint-clean (closes #1)
check / check (push) Failing after 0s

Standard scaffold: script/ entrypoints with the Makefile as thin shims, a Dockerfile whose lint and test phases gate the build, a Gitea CI workflow running script/cibuild, REPO_POLICIES.md, TODO.md, .editorconfig, .dockerignore, LICENSE, wider .gitignore. .golangci.yml is byte-identical to the canonical copy in the prompts repo.

211 lint findings fixed in code: package globals became functions/fields and a cobra command constructor, magic numbers became named constants, ctx is threaded into the probes, monitor loops split. Tests moved to external _test packages with export_test.go. Behavior unchanged.

Readers will trip over: make lint/test/check now need a Docker daemon; the personal rsync copy/run targets are gone and make run runs locally.
Disclosure: four //nolint:gosec remain on the fixed-argv ping/curl calls and the operator-chosen log file, as the reference repo annotates the same class.
Disclosure: module path left as-is.

Model: opus-4-8 (implementation); fable-5-1 (merge)
This commit was merged in pull request #5.
This commit is contained in:
2026-09-21 09:22:28 +02:00
parent cf9dc39053
commit 7dd4ac798d
34 changed files with 2172 additions and 884 deletions
+55 -25
View File
@@ -1,6 +1,8 @@
# rtnetmon
Real-time network monitoring dashboard for Linux systems with dual-interface support.
rtnetmon is a WTFPL-licensed Go terminal (CLI/TUI) network monitor by
[@sneak](https://sneak.berlin) that shows real-time network health, packet
loss, and latency across two Linux network interfaces at once.
## Overview
@@ -34,13 +36,13 @@ for a clean, real-time dashboard interface.
```bash
git clone https://git.eeqj.de/sneak/rtnetmon.git
cd rtnetmon
make build
make build # produces ./bin/rtnetmon
```
## Usage
```bash
sudo ./rtnetmon --ifaceA eth0 --labelA "Primary WAN" --ifaceB wlan0 --labelB "Backup WiFi"
sudo ./bin/rtnetmon --ifaceA eth0 --labelA "Primary WAN" --ifaceB wlan0 --labelB "Backup WiFi"
```
### Command Line Options
@@ -60,41 +62,69 @@ sudo ./rtnetmon --ifaceA eth0 --labelA "Primary WAN" --ifaceB wlan0 --labelB "Ba
```
rtnetmon/
├── cmd/rtnetmon/ # Main entry point
├── cmd/rtnetmon/ # main entry point (thin: calls internal/cli)
│ └── main.go
├── internal/
│ ├── cli/ # Command-line interface using Cobra
│ ├── cli/ # command-line interface using Cobra
│ │ └── root.go
│ └── monitor/ # Core monitoring functionality
│ ├── monitor.go # Main monitoring types and functions
│ ├── loops.go # Monitoring loops (reachability, loss, TCP)
│ ├── styles.go # Terminal color styles
│ └── ui.go # User interface rendering
├── go.mod
├── go.sum
├── Makefile
│ └── monitor/ # core monitoring functionality
│ ├── monitor.go # monitor types, probes, logging
│ ├── loops.go # monitoring loops (reachability, loss, TCP)
│ ├── styles.go # terminal color styles
│ └── ui.go # user interface rendering
├── script/ # Scripts to Rule Them All entrypoints
├── .gitea/workflows/ # CI (runs script/cibuild)
├── Dockerfile # lint + test gate phases and the build
├── Makefile # thin shims over script/
├── .golangci.yml # vendored linter config
├── go.mod / go.sum
└── README.md
```
## Development
### Building
```bash
make build # Build the binary
make test # Run tests
make lint # Run linter
make fmt # Format code
make all # Format, lint, test, and build
make check # run test, lint, and fmt-check (the default target)
make build # build ./bin/rtnetmon
make run # build, then run ./bin/rtnetmon locally
make dev # go run ./cmd/rtnetmon
make test # run the test suite (test phase of the Dockerfile)
make lint # run golangci-lint (lint phase of the Dockerfile)
make fmt # format Go code (writes)
make fmt-check # verify formatting (read-only)
make deps # go mod download + go mod tidy
make docker # build the Docker image
make cibuild # bootstrap, check, and build the image (run by CI)
make bootstrap # install dependencies idempotently (git, make, go)
make setup # bootstrap plus install the git pre-commit hook
make hooks # install the git pre-commit hook
make clean # remove build artifacts
```
### Testing
Linting and testing run in Docker so results do not depend on host tooling;
`make lint`, `make test`, `make docker`, and `make cibuild` therefore require
a Docker daemon. `make check` must be green before committing, and the
pre-commit hook (`make hooks`) runs it.
The project includes unit tests for core functionality. Run tests with:
## Entrypoints
```bash
make test
```
This repository adheres to the
[Scripts to Rule Them All](https://github.com/github/scripts-to-rule-them-all)
standard: normalized scripts in `script/` are the entrypoints for the
development workflow, and the Makefile targets are thin shims that call them.
- `script/bootstrap` — install dependencies idempotently (git, make, go).
- `script/setup` — bootstrap plus install the git pre-commit hook.
- `script/projectname` — output the project name.
- `script/test` — run the test suite as the Dockerfile `test` phase.
- `script/lint` — run golangci-lint as the Dockerfile `lint` phase.
- `script/fmt` — format Go code (host).
- `script/fmt-check` — verify formatting (host, read-only).
- `script/check` — run test, lint, and fmt-check.
- `script/docker` — build the Docker image.
- `script/cibuild` — bootstrap, check, and build the image; run by CI.
- `script/precommit` — run by the pre-commit hook (go mod tidy check + check).
- `script/install-precommit` — install the pre-commit hook.
### Using the Monitor API