Simplify configuration: connection defaults + optional queue numbers
Closes #20 (closed).
Summary
- Adds an optional top-level
defaults:section to--configYAML files: overall defaults forjump_user/jump_host/forwarded_ports, plus CIDR-scoped overrides viadefaults.by_network. An explicit value on a connection always wins over any default. - Most-specific-CIDR-wins: when a connection's
networkmatches more than oneby_networkentry, the entry with the longest/most specific prefix wins, not whichever is listed first (a tie between equally specific matches falls back to list order). Documented explicitly inREADME.md,docs/README.md,docs/config.example.yaml, andCLAUDE.md. queue_numberis now optional: if omitted, a stable number is deterministically auto-assigned from a hash of the connection'sname(requiresnameto be set in that case). This is derived fromnamespecifically so a connection's number stays stable across restarts even if other connections are added/removed/reordered elsewhere in the file - important because the existing crash-recovery iptables cleanup is keyed only by queue number, so an unstable number could orphan stale rules after a crash.internal/configremains at 100% test coverage; new tests cover defaults merging (overall + by_network + explicit-wins + most-specific-CIDR-wins + tie-break), the newjump_user/jump_hostvalidation errors, and queue number auto-assignment (range, determinism, collision-probing, missing-name error).
Not included
config.production.yaml(untracked, real prod config) is not touched by this MR - it isn't under version control. Migrating it to usedefaults/by_network/optionalqueue_numberis a natural follow-up once this lands.- Version tag
v1.0.1will be pushed separately after this MR is reviewed and merged, same asv1.0.0was for the previous release.
Test plan
-
go build ./... -
make lint(golangci-lint + yamllint) -
make test(go test -race -cover ./...) - Manually loaded
docs/config.example.yamlviaconfig.LoadFromFileand confirmed defaults/CIDR-scoping/queue-number auto-assignment all resolve as documented