11 releases

0.3.1 Dec 5, 2025
0.3.0 Oct 14, 2025
0.2.7 Aug 15, 2025
0.2.6 May 28, 2025
0.1.0 Dec 1, 2022

#1152 in Network programming

Download history 1101/week @ 2025-10-13 889/week @ 2025-10-20 1313/week @ 2025-10-27 2069/week @ 2025-11-03 2189/week @ 2025-11-10 1913/week @ 2025-11-17 1794/week @ 2025-11-24 1690/week @ 2025-12-01 1879/week @ 2025-12-08 1826/week @ 2025-12-15 878/week @ 2025-12-22 725/week @ 2025-12-29 1464/week @ 2026-01-05 1452/week @ 2026-01-12 1666/week @ 2026-01-19 1578/week @ 2026-01-26

6,289 downloads per month
Used in 2 crates

Apache-2.0

250KB
6.5K SLoC

Mozim -- DHCP Client Library

Example code:

use mozim::{DhcpV4Client, DhcpV4Config, DhcpV4State};

const TEST_NIC: &str = "dhcpcli";

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut config = DhcpV4Config::new(TEST_NIC);
    config.set_host_name("mozim-test");
    config.use_host_name_as_client_id();
    config.set_timeout_sec(300);
    let mut cli = DhcpV4Client::init(config, None).await?;
    let mut got_lease = None;

    loop {
        let state = cli.run().await?;
        println!("DHCP state {state}");
        if let DhcpV4State::Done(lease) = state {
            println!("Got DHCPv4 lease {lease:?}");
            got_lease = Some(lease);
        } else {
            println!("DHCPv4 on {TEST_NIC} enter {state}");
        }
    }
}

Try out

# Below script will create veth eth1/eth1.ep.
# The `eth1.ep` is DHCP server interface running dnsmasq in `mozim` network
# namespace.
sudo ./utils/test_env_mozim &
cargo run --example mozim_dhcpv4
cargo run --example mozim_dhcpv6

Dependencies

~8–20MB
~233K SLoC