- Rust 1.88+ (edition 2024)
protobuf-compiler(apt-get install protobuf-compileron Debian/Ubuntu)- Linux x86_64 or aarch64 (primary targets)
- macOS works for development but is not CI-tested
- Docker + containerlab for interop tests
git clone https://github.com/lance0/rustbgpd
cd rustbgpd
cargo build --workspace # builds rustbgpd + rustbgpctl
cargo test --workspacecargo fmt # Format
cargo clippy -- -D warnings # Lint with warnings as errors
cargo test --workspace # All testsAll PRs must pass (enforced by CI in .github/workflows/ci.yml):
cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace
- No
unsafecode without aSAFETYcomment and strong justification - Keep lines under 100 characters when possible
#![deny(unsafe_code)]on every crate — this is enforced, not advisory
- Start with a verb: Add, Fix, Update, Remove, Refactor, Bump
- Keep the first line under 72 characters
- Use the body for context when needed
Examples:
Add NOTIFICATION encode/decode to wire crate
Fix hold time negotiation edge case for zero values
Update FRR interop topology to 10.3.1
Refactor FSM event dispatch to use match exhaustiveness
Version bumps:
Bump version to v0.1.0
Roadmap/docs updates:
roadmap: add M1 exit criteria
docs: update interop matrix for BIRD 2.16
src/main.rs # Binary entry point — config, wiring, shutdown
src/config/ # TOML config types, loading, validation
src/metrics_server.rs # Prometheus /metrics HTTP endpoint
crates/
wire/ # BGP codec — zero internal deps, independently publishable
fsm/ # RFC 4271 state machine — pure, no I/O
transport/ # Tokio TCP glue — session runtime, BMP event emission
rib/ # RIB data structures, best-path selection, route distribution
policy/ # Match + modify + filter engine: prefix, community, AS_PATH regex, RPKI
rpki/ # RPKI origin validation: RTR client (RFC 8210), VRP table
bmp/ # BMP exporter (RFC 7854): codec, per-collector client, manager
mrt/ # MRT dump export (RFC 6396): codec, writer, manager
api/ # gRPC server (tonic) — 7 services
telemetry/ # Prometheus metrics + structured tracing
cli/ # rustbgpctl — gRPC CLI with human-readable and JSON output
proto/ # gRPC proto definitions (rustbgpd.v1)
tests/interop/ # Containerlab topologies and configs
docs/ # Design doc, RFC notes, interop results, ADRs
These are not guidelines — they are enforced invariants:
wiredepends on nothing internal — it is a pure codec libraryfsmdepends only onwiretypesfsmnever imports tokio, never touches I/Opolicydepends only onwirerpkidepends only onwirebmpandtelemetryhave no internal dependenciesribdepends onwire,policy,telemetry, andrpkitransportowns BGP peer session I/O and drives the FSM — it depends onwire,fsm,rib,policy,telemetry, andbmpclihas no internal crate dependencies (client-only proto stubs)
- Fork the repository
- Create a feature branch from
main - Make changes, ensure all checks pass
- Submit PR with a clear description
- Bug fixes: Steps to reproduce, how you verified the fix
- New protocol behavior: RFC citation and proposed interop test
- New features: Update CHANGELOG.md and relevant docs
- Architectural changes (open an issue)
- New protocol extensions (open an issue with RFC citation)
- Changes to design constraints (these are non-negotiable — read DESIGN.md)
Every protocol feature must be validated against real peers in containerlab. Unit tests are necessary but not sufficient.
# Deploy a test topology
containerlab deploy -t tests/interop/m0-frr.clab.yml
# Tear down
containerlab destroy -t tests/interop/m0-frr.clab.ymlUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as MIT/Apache-2.0, without any additional terms or conditions.