1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! `gateflow` isolates test code inside a real, unprivileged Linux network
//! namespace — not a simulated one.
//!
//! Crates like [`turmoil`](https://docs.rs/turmoil) and
//! [`madsim`](https://docs.rs/madsim) get you fast, deterministic tests by
//! *simulating* the network in userspace. `gateflow` takes the opposite
//! trade: real kernel network namespaces, real sockets, real `tc netem`
//! chaos — slower, but nothing is faked. If a test passes here, it passed
//! against the same networking stack production runs on.
//!
//! # Status
//!
//! Early and incomplete. [`Sandbox`] is the entry point: a single
//! unprivileged network namespace with a working loopback, optional real
//! `tc netem` chaos on it ([`Sandbox::chaos`]), or (via
//! [`Sandbox::paired`]) two namespaces wired together by a real veth
//! pair. The `#[gateflow::isolated_net]` attribute macro (`macros`
//! feature, see the `gateflow-macros` companion crate) wraps a test to
//! run inside a plain (non-chaos, non-paired) sandbox. Resource limits
//! Optional cgroup v2 resource limits and a defense-in-depth seccomp-BPF
//! profile are available through [`CgroupLimits`] and [`SeccompProfile`].
//!
//! [`Sandbox`] is a thin builder over [`netns`]/[`chaos`]/[`veth`], which
//! stay public for direct use if you want to skip it — see their own
//! docs for the exact mechanisms and sentinel exit codes.
//!
//! # Platform
//!
//! Linux only. Namespace isolation is a Linux kernel feature with no
//! portable equivalent.
compile_error!;
pub use Error;
pub use ;
pub use ;
/// Wraps a test function so its body runs inside a freshly created,
/// unprivileged network namespace instead of the host's. Requires the
/// `macros` feature. See [`gateflow_macros::isolated_net`] for the full
/// docs.
pub use isolated_net;