- Core application code is in
src/. src/main.rs: runtime wiring (UDP/TCP listeners, limits, timeouts).src/config.rs: config loading/validation (CLI > env > TOML).src/dns.rs: authoritative DNS response logic.src/limits.rs: rate and connection limiters.- Integration tests live in
tests/(tests/e2e.rs) and exercise the real binary over sockets. README.md(user-facing docs),PRODUCTION_READINESS.md(internet exposure checklist),leaf.example.toml(config template),.gitlab-ci.yml(pipeline definition).- Container deployment assets:
Containerfileand.containerignore.
cargo build— compile debug binary.cargo build --release— compile optimized release binary.cargo run -- --help— inspect CLI flags.cargo fmt --all -- --check— verify formatting.cargo check --all-targets --all-features --locked— fast compile verification.cargo clippy --all-targets --all-features --locked -- -D warnings— enforce lint cleanliness.cargo test --locked— run unit + integration tests.cargo test --all-targets --all-features --release --locked— extended test run.opal run --no-tui— run local CI pipeline emulation.podman build -t leaf:latest -f Containerfile .— build container image.podman run --rm -e LEAF_ZONES=dev.example.com,prod.example.com -p 5300:5300/udp -p 5300:5300/tcp leaf:latest— run in container.
- Rust 2024 edition, standard
rustfmtstyle (4-space indentation by formatter). - Prefer small, focused functions and explicit error propagation (
Result, nounwrapin production paths). - Naming conventions:
snake_casefor functions/variables/modules.CamelCasefor types/structs/enums.- Clear config names matching env/TOML keys (e.g.,
per_ip_qps_limit).
- Add unit tests near logic modules (
#[cfg(test)]insrc/*.rs). - Add behavior-level integration tests in
tests/when changing runtime/network behavior. - Test names should describe behavior (e.g.,
returns_nxdomain_with_soa_authority). - Before opening a PR, run
fmt,check,clippy, and both test commands.
- Follow conventional-style commit prefixes seen in history:
feat:,fix:,test:,ci:,docs:,chore:. - Keep commits scoped and meaningful (avoid mixing unrelated changes).
- Use signed + signed-off commits where required (
git commit -sS). - PRs should include:
- Concise summary.
- Rationale and risk notes.
- Test evidence (local command output or CI/opal result).
- Config/doc updates when behavior changes.
- Do not commit
leaf.toml(local runtime config); useleaf.example.toml. - For public deployment, follow
PRODUCTION_READINESS.mdand run as non-root with least privileges.