#narrowlink #routes #customized #temporary #indexing #table #platform

narrowlink-custom-dependencies

This crate provides temporary indexing for customized Rust libraries to be used in Narrowlink

1 unstable release

0.0.1 Nov 4, 2023

#7 in #narrowlink

MIT license

68KB
2K SLoC

Rust 1K SLoC // 0.0% comments C 747 SLoC // 0.1% comments

This crate provides temporary indexing for customized Rust libraries to be used in Narrowlink


lib.rs:

This project aims to provide a high level interface for manipulating and observing the routing table on a variety of platforms.

Examples

Adding a route

// route traffic destined for 10.14.0.0/24 to 192.1.2.1 using interface 9
let handle = Handle::new()?;
let route = Route::new("10.14.0.0".parse().unwrap(), 24)
    .with_ifindex(9)
    .with_gateway("192.1.2.1".parse.unwrap());
handle.add(&route).await

Listening to changes in the routing table

let handle = Handle::new()?;
let stream = handle.route_listen_stream();
futures::pin_mut!(stream);
while let Some(event) = stream.next().await {
    println!("{:?}", value);
}

Dependencies

~3–12MB
~136K SLoC