Crates.io | netns-rs |
lib.rs | netns-rs |
version | 0.1.0 |
source | src |
created_at | 2022-04-25 09:54:03.741538 |
updated_at | 2022-04-25 09:54:03.741538 |
description | A library to handle Linux network namespaces in Rust |
homepage | |
repository | https://github.com/openanolis/netns-rs.git |
max_upload_size | |
id | 573761 |
size | 43,992 |
The netns-rs crate provides an ultra-simple interface for handling network namespaces in Rust. Changing namespaces requires elevated privileges, so in most cases this code needs to be run as root.
This crate only supports linux kernel.
cargo build
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="sudo -E" cargo test
or
sudo -E cargo test
The main resource so far has been the source code of netns(golang), CNI network plugins and iproute2.
https://github.com/little-dude/netlink: rtnetlink/src/ns.rs
provides the same functionality, but its creation of netns in a new process feels a bit heavy.
This code is licensed under Apache-2.0.