Contributing
Working on SnmpLens
Bug reports, patches and MIB compatibility problems are all welcome. This page is the
short version; the repository's CLAUDE.md carries the architectural
reasoning in far more detail.
Setting up
On Debian or Ubuntu you also need the GTK and WebKit development headers:
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
Building and running
wails dev # hot-reload development server
wails build # production binary into build/bin/
Linux needs the build tag:
wails build -platform linux/amd64 -tags webkit2_41. The same tag belongs on
every go command you run against this repository.
The bridge between Go and the interface
The frontend calls Go through bindings generated into frontend/wailsjs/.
That directory is not in the repository — it is regenerated by
wails dev and wails build, and a fresh clone has none until the
first build.
After changing any exported method on the App struct, or any Go type that
crosses the bridge, you must regenerate before the frontend can use it. Request
parameters are structs in pkg/snmp/params.go mirrored by plain objects in
frontend/src/utils/snmpParams.js; the JSON field names are the contract and
the two are kept in step by hand.
Before you open a pull request
These are what CI runs, from the repository root:
go vet -tags webkit2_41 ./...
go test -race -tags webkit2_41 ./...
staticcheck ./...
go mod tidy && git diff --exit-code go.mod go.sum
govulncheck ./...
cd frontend && npm test
-race is not optional: the MIB library keeps global state and Wails
dispatches every bound method on its own goroutine, so this is the class of bug the
detector exists for.
About the tests
There are deliberately not many, and they are not there for coverage. Each one targets logic that is subtle and can break silently — storage pragmas and migrations, threshold semantics, the poll clock, counter-wrap arithmetic, index encoding round-trips, the delivery outbox.
The frontend suite exists for the same reason. It compiles every Svelte component and fails on a reference to something that does not exist, because that warning is emitted into output nobody reads while the branch throws at runtime. It also checks that the five locale files carry the same keys and the same placeholders, since the translation library falls back silently and a locale can drift for months before anyone who reads that language notices.
If you add a test, please make it fail first. A test that has never been seen to fail is a test that may not be testing anything.
Testing without hardware
tools/snmp_test_agent.py is a pure-Python SNMP agent covering v1, v2c and
full v3, with moving counters and periodic traps. The
documentation lists its credentials.
python tools/snmp_test_agent.py --trap-port 1162 --trap-interval 10
Two tests in pkg/monitor talk to a real agent and skip unless you point them at one:
python tools/snmp_test_agent.py --port 11611 --no-traps
SNMPLENS_TEST_AGENT=127.0.0.1:11611 go test ./pkg/monitor/ -run Integration -v
Reporting a bug
What makes a report actionable, roughly in order of usefulness:
- What you did, what happened, and what you expected instead.
- The version, from Settings → About, and your operating system.
- For an SNMP problem: the version in use, and whether the same request works from
snmpwalk. - For a MIB problem: the MIB file, if you are able to share it, and what the diagnostics said.
Anonymous Mode (Ctrl Shift A) exists partly for this: it replaces addresses and credentials with stable aliases so a screenshot is safe to attach.
Style
Match the code around you. The one convention worth naming: comments here explain why, not what — usually by recording the failure that made the code look the way it does. A comment that restates the line above it will be asked about; one that says “this used to be X, and here is what broke” is the point.
People
Everyone who has contributed to the repository.
Found a security problem instead? Please read the security policy first — do not open a public issue.