Skip to main content

lab_ops_natmap/
lib.rs

1//! `natmap` — iptables NAT rule management for static VMs and Docker containers.
2//! Control daemon for iptables forwarding and DNAT rules via a Unix socket API.
3//!
4//! This crate provides a daemon that acts as the central authority for all
5//! iptables NAT rules. It handles:
6//!
7//! - **Static DNAT/SNAT/hairpin rules** for VMs with persistent configuration
8//! - **Dynamic Docker port mappings** that auto-discover published ports at
9//!   container start and allow host-port remapping without restarting containers
10//! - **Crash recovery** by persisting state to disk and flushing stale rules on
11//!   restart
12//! - **Port conflict prevention** via a TCP pre-bind allocator
13//!
14//! The daemon exposes an HTTP API over a Unix socket. CLI commands in the
15//! parent crate communicate with it through [`cli::run_cli`].
16
17pub mod api;
18pub mod cli;
19pub mod command;
20pub mod completions;
21pub mod consts;
22pub mod daemon;
23pub mod docker;
24pub mod install;
25pub mod iptables;
26pub mod models;
27pub mod policy_route;
28pub mod utils;