The netns-rs crate provides an ultra-simple interface for handling network namespaces in Rust.

Overview

netns-rs

static UT codecov

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.

Build

cargo build

Test(as root)

CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="sudo -E" cargo test

or

sudo -E cargo test

Credits

The main resource so far has been the source code of netns(golang), CNI network plugins and iproute2.

Altnernatives

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.

License

This code is licensed under Apache-2.0.

You might also like...
An experimental IPC interface definition language for Hubris.

Idol: interface definitions for Hubris This is an experimental interface definition language for defining IPC interfaces between tasks in a Hubris app

Network simulation in Rust

netsim - A Rust library for network simulation and testing (currently linux-only). netsim is a crate for simulating networks for the sake of testing n

A Rust library for parsing the SOME/IP network protocol (without payload interpretation).

someip_parse A Rust library for parsing the SOME/IP network protocol (without payload interpretation). Usage Add the following to your Cargo.toml: [de

Common Rust Lightning Network types

Common Rust Lightning Network types Warning: while in a good state, this is still considered a preview version! There are some planned changes. This l

Network Block Storage server, written in Rust. Supports pluggable and chainable underlying storage

nbd-rs Disclaimer DO NEVER USE THIS FOR PRODUCTION Do not use this for any data that you cannot afford to lose any moment. Expect data loss, corruptio

A set of Rust crates for interacting with the Matrix chat network.

Ruma – Your home in Matrix. A set of Rust crates (libraries) for interacting with the Matrix chat network. website • chat • documentation (unstable) G

Reliable p2p network connections in Rust with NAT traversal
Reliable p2p network connections in Rust with NAT traversal

Reliable p2p network connections in Rust with NAT traversal. One of the most needed libraries for any server-less / decentralised projects

Reliable p2p network connections in Rust with NAT traversal
Reliable p2p network connections in Rust with NAT traversal

Reliable p2p network connections in Rust with NAT traversal. One of the most needed libraries for any server-less, decentralised project.

A private network system that uses WireGuard under the hood.

innernet A private network system that uses WireGuard under the hood. See the announcement blog post for a longer-winded explanation. innernet is simi

Comments
  • Refactor to remove netns.

    Refactor to remove netns.

    When netns is deleted, the NetNs instance will no longer be available and we should use the self argument in the remove function in order to consume the NetNs instance.

    Signed-off-by: wllenyj [email protected]

    opened by wllenyj 1
Owner
OpenAnolis Community
OpenAnolis Community
OpenAnolis Community
Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions.

Synthetic Network Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions. Dependenc

Daily 58 Dec 15, 2022
Simple in-network file transfer with barely any overhead.

fftp fftp is the "Fast File Transport Protocol". It transfers files quickly between computers on a network with low overhead. Motivation FTP uses two

leo 4 May 12, 2022
Hotwire allows you to study network traffic of a few popular protocols in a simple way

Hotwire Hotwire is a gtk GUI application that leverages the wireshark and tshark infrastructure to capture traffic and explore the contents of tcpdump

null 194 Dec 30, 2022
A simple configuration-based module for inter-network RPC in Holochain hApps.

DNA Auth Resolver A simple configuration-based module for inter-network RPC in Holochain hApps. About Usage In the origin zome In the destination DNA

Shadman Baig 0 Feb 4, 2022
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...

Tokio A runtime for writing reliable, asynchronous, and slim applications with the Rust programming language. It is: Fast: Tokio's zero-cost abstracti

Tokio 18.7k Dec 30, 2022
This Intelligent Transportation Systems (ITS) MQTT client based on the JSon ETSI specification transcription provides a ready to connect project for the mobility

This Intelligent Transportation Systems (ITS) MQTT client based on the JSon ETSI specification transcription provides a ready to connect project for the mobility (connected and autonomous vehicles, road side units, vulnerable road users,...). Let's connect your device or application to our Intelligent Transport Systems (ITS) platform!

Orange 4 Nov 29, 2022
Afterglow-Server provides back-end APIs for the Afterglow workflow engine.

Afterglow-Server ?? Note: This project is still heavily in development and is at an early stage. Afterglow-Server provides back-end APIs for the After

梦歆 0 Jun 2, 2022
Podman-api-rs - Rust interface to Podman (libpod).

podman-api Rust interface to Podman Usage Add the following to your Cargo.toml file [dependencies] podman-api = "0.1" SSL Connection To enable HTTPS c

Wojciech Kępka 43 Dec 29, 2022
Rust implementation of the JDA-NAS interface

udpqueue.rs This is a rust implementation of the original JDA-NAS natives. This can be used to make a minimal modular jar with only the required targe

Florian Spieß 13 Mar 8, 2023
Tunnel TCP traffic through SOCKS5 or HTTP using a TUN interface.

tun2proxy Tunnel TCP traffic through SOCKS5 or HTTP on Linux. Authentication not yet supported. Error handling incomplete and too restrictive. Build C

B. Blechschmidt 34 Nov 29, 2022