Johnathan Corgan 0d93a19e07 Implement cost-based parent selection with periodic re-evaluation
Cost-based parent selection:
- Replace depth-only parent selection with effective_depth = depth + link_cost
- link_cost computed from locally measured MMP metrics: etx * (1.0 + srtt_ms / 100.0)
- Prevents bottleneck subtrees in heterogeneous networks where a LoRa link
  at depth 1 would otherwise always beat fiber at depth 2
- Configurable hysteresis (default 0.2) prevents marginal parent switches
- Configurable hold-down timer (default 30s) suppresses re-evaluation
  after parent switch
- Mandatory switches (parent lost, root change) bypass both safeguards
- Link costs passed as HashMap parameter to keep TreeState pure

Periodic re-evaluation:
- evaluate_parent() was only called on TreeAnnounce receipt or parent loss;
  after tree stabilization, link degradation went undetected
- Added timer-based re-evaluation (reeval_interval_secs, default 60s) that
  calls evaluate_parent() from the tick handler with current MMP link costs
- Respects existing hold-down and hysteresis safeguards
- Short-circuits when disabled or <2 peers

Design documentation:
- Update 7 design docs to reflect cost-based parent selection
- Replace depth-only algorithm descriptions with effective_depth model
- Replace rejected cumulative path cost spec with local-only design rationale
- Rewrite Example 2 (heterogeneous links) for local-only cost model
- Update config docs: parent_switch_threshold replaced by parent_hysteresis,
  hold_down_secs, reeval_interval_secs

Chaos simulation enhancements:
- fips_overrides with deep merge for per-scenario FIPS config customization
- Explicit topology algorithm for deterministic test graphs
- Control socket querying via fipsctl for tree/MMP snapshot collection
- Edge existence validation in netem manager
- Per-link netem policy overrides
- 9 new chaos scenarios covering cost avoidance, depth-vs-cost tradeoffs,
  stability, mixed topologies, periodic re-evaluation, and bottleneck parent

12 new unit tests, 667 total passing, clippy clean.
2026-02-23 17:15:20 +00:00
2026-02-22 20:52:55 +00:00
2026-02-22 20:52:55 +00:00

FIPS: Free Internetworking Peering System

A distributed, decentralized network routing protocol for mesh nodes connecting over arbitrary transports.

Status: Experimental / Pre-release

FIPS is under active development. The protocol and APIs are not stable. Expect breaking changes.

Overview

FIPS is a self-organizing mesh network that operates natively over a variety of physical and logical media — local area networks, Bluetooth, serial links, radio, or the existing internet as an overlay. Nodes generate their own identities, discover each other, and route traffic without any central authority or global topology knowledge.

FIPS uses Nostr keypairs (secp256k1/schnorr) as native node identities, making every Nostr user a potential network participant. Nodes address each other by npub, and the same cryptographic identity used in the Nostr ecosystem serves as both the routing address and the basis for end-to-end encrypted sessions across the mesh.

Features

  • Self-organizing mesh routing — spanning tree coordinates and bloom filter candidate selection, no global routing tables
  • Multi-transport — UDP/IP overlay today; designed for Ethernet, Bluetooth, serial, radio, and Tor
  • Noise encryption — hop-by-hop link encryption plus independent end-to-end session encryption
  • Nostr-native identity — secp256k1 keypairs as node addresses, no registration or central authority
  • IPv6 adaptation — TUN interface maps npubs to fd00::/8 addresses for unmodified IP applications
  • Metrics Measurement Protocol — per-link RTT, loss, jitter, and goodput measurement
  • Operator visibilityfipsctl control socket interface for runtime inspection of peers, links, sessions, tree state, and metrics
  • Zero configuration — sensible defaults; a node can run with no config file

Quick Start

Requirements

  • Rust 1.85+ (edition 2024)
  • Linux (TUN interface requires CAP_NET_ADMIN or root)

Build

git clone https://github.com/jmcorgan/fips.git
cd fips
cargo build --release

Run

# With default configuration (ephemeral identity, default ports):
sudo ./target/release/fips

# With a configuration file:
sudo ./target/release/fips -c fips.yaml

See docs/design/fips-configuration.md for the full configuration reference.

Multi-node Testing

See testing/ for Docker-based integration test harnesses including static topology tests and stochastic chaos simulation.

Documentation

Protocol design documentation is in docs/design/, organized as a layered protocol specification. Start with fips-intro.md for the full protocol overview.

Project Structure

src/          Rust source (library + fips/fipsctl binaries)
docs/design/  Protocol design specifications
testing/      Docker-based integration test harnesses
benches/      Criterion benchmarks

License

MIT — see LICENSE.

Description
The Free Internetworking Peering System
Readme MIT 30 MiB
Languages
Rust 86.1%
Shell 10.4%
Python 3%
PowerShell 0.2%
Makefile 0.1%