Skip to main content

Crate net_lattice

Crate net_lattice 

Source
Expand description

Cross-platform inspection, mutation, and monitoring of operating-system networking through a strongly typed Rust API.

Start with Lattice::connect to inspect interfaces, addresses, routes, DNS configuration, and neighbor tables; perform supported mutations; or subscribe to network change events.

§Example

use net_lattice::{Lattice, Result};

fn main() -> Result<()> {
    let lattice = Lattice::connect()?;
    for interface in lattice.interfaces()? {
        println!("{interface:?}");
    }
    Ok(())
}

§Facade design

Re-exports the types consumers need from net-lattice-model and net-lattice-ip, selects a default backend based on cfg(target_os = "..."), and enforces model convergence: net-lattice-platform’s generic provider traits are constrained here to Net Lattice’s own model types, without net-lattice-platform ever depending on net-lattice-model. See ARCHITECTURE.md for the full rationale.

Structs§

Capability
Runtime-dependent operating system features that cannot be expressed through Rust trait implementation alone.
DnsConfig
The resolver configuration observed through the active platform backend.
EventFilter
A composable filter for event domains and individual network objects.
EventReceiver
EventStream
Async event adapters, enabled by the async feature. A runtime-agnostic asynchronous stream of network change events.
Id
A phantom-typed identifier, generic over the domain object it names.
Interface
A network interface.
InterfaceAddress
An IP address assigned to a network interface, plus the prefix length it was assigned with (e.g. 192.168.1.10/24).
Ipv4Address
A typed IPv4 address.
Ipv4Network
An IPv4 network: an address paired with a prefix length.
Ipv4PrefixLength
A validated IPv4 prefix length (0..=32).
Ipv6Address
A typed IPv6 address.
Ipv6Network
An IPv6 network: an address paired with a prefix length.
Ipv6PrefixLength
A validated IPv6 prefix length (0..=128).
Lattice
The top-level entry point: a connected backend for the current system.
MacAddress
A MAC (Ethernet hardware) address.
NeighborEntry
A single entry in the system’s neighbor table (ARP for IPv4, NDP for IPv6): the mapping from an on-link IP address to a link-layer (MAC) address, as observed or configured on a given interface.
NewInterfaceAddress
Intent to assign an IP address to an interface.
Route
A single routing table entry.

Enums§

AdminState
The administrative state of an interface, as configured by the operator.
ChangeKind
What kind of change an Event reports.
Error
The single error type surfaced across the Net Lattice workspace.
Event
A signal that something changed in the system’s networking state — carrying an ID and a ChangeKind, not a clone of the full domain object.
EventDomain
A domain whose state must be re-read after an overflow notification.
InterfaceKind
The kind of a network interface.
IpAddress
An IP address of either family.
NeighborState
The reachability state of a neighbor entry, per the Neighbor Unreachability Detection state machine shared (with minor naming differences) by Linux’s NUD_* states, BSD/macOS’s route-socket RTF_* flags on an ARP/NDP entry, and Windows’s NL_NEIGHBOR_STATE.
Network
An IP network of either family.
OperationalState
The operational state of an interface, as observed from the link layer.
PlatformErrorCode
A platform-tagged raw error code.

Traits§

AddressMutator
Assigns and removes IP addresses on network interfaces.
AddressProvider
Lists IP addresses assigned to network interfaces.
CapabilityProvider
Reports which runtime-dependent Capability flags the connected backend currently has available.
DnsProvider
Reads the system’s current DNS resolver configuration.
EventProvider
Subscribes to filtered change notifications for the domains and objects a backend supports.
InterfaceProvider
Lists network interfaces.
LatticeBackend
Bound satisfied by any backend usable with Lattice.
NeighborProvider
Lists neighbor table entries (ARP for IPv4, NDP for IPv6).
RouteProvider
Lists, adds, and removes routes.
TokioEventProvider
Backend contract for native Tokio-based event delivery.

Type Aliases§

InterfaceAddressId
Identifies an InterfaceAddress.
InterfaceId
Identifies an Interface.
NeighborId
Identifies a NeighborEntry.
Result
A result returned by Net Lattice operations.
RouteId
Identifies a Route.