Skip to main content

microsandbox_network/
lib.rs

1//! `microsandbox-network` provides the smoltcp in-process networking engine
2//! for sandbox network isolation and policy enforcement.
3
4// New lints introduced in rustc 1.95 fire on existing code; addressing
5// them is out of scope for the current change and tracked separately.
6#![allow(
7    clippy::useless_conversion,
8    clippy::identity_op,
9    clippy::unnecessary_cast,
10    clippy::needless_update,
11    clippy::manual_c_str_literals
12)]
13
14mod addr;
15pub mod proxy;
16
17pub mod config;
18pub mod dns;
19pub mod icmp;
20pub mod netstack;
21pub mod network;
22pub mod policy;
23pub mod ports;
24pub mod secrets;
25pub mod tcp;
26pub mod tls;
27pub mod udp;
28
29//--------------------------------------------------------------------------------------------------
30// Constants
31//--------------------------------------------------------------------------------------------------
32
33/// Static hostname the guest uses to reach the sandbox host.
34///
35/// The host-side DNS interceptor matches guest queries against this
36/// name, and agentd writes the same name into `/etc/hosts`.
37pub(crate) const HOST_ALIAS: &str = "host.microsandbox.internal";
38
39//--------------------------------------------------------------------------------------------------
40// Re-Exports
41//--------------------------------------------------------------------------------------------------
42
43#[doc(hidden)]
44pub use config::ResolvedNetworkConfig;
45pub use proxy::{
46    OutboundProxy, OutboundProxyBuildError, OutboundProxyBuilder, OutboundProxyConfig,
47    OutboundProxyParseError, OutboundProxyProtocol, Socks4ProxyBuilder, Socks5Credentials,
48    Socks5ProxyBuilder,
49};
50
51pub use config::builder;
52pub use icmp::{error as icmp_error, relay as icmp_relay};
53pub use netstack::{backend, device, poll as stack, shared};
54pub use ports::publisher;
55pub use tcp::connection as conn;
56pub use udp::{fragments as udp_fragments, relay as udp_relay};