#address #networking #interface

mac_address

Cross-platform retrieval of a network interface MAC address

19 releases (stable)

1.1.8 Feb 10, 2025
1.1.7 May 22, 2024
1.1.6 Apr 16, 2024
1.1.5 May 25, 2023
0.8.0 Jul 21, 2018

#72 in Network programming

Download history 34306/week @ 2024-11-21 34871/week @ 2024-11-28 38077/week @ 2024-12-05 36915/week @ 2024-12-12 42998/week @ 2024-12-19 31067/week @ 2024-12-26 33957/week @ 2025-01-02 32314/week @ 2025-01-09 35380/week @ 2025-01-16 38139/week @ 2025-01-23 44731/week @ 2025-01-30 51787/week @ 2025-02-06 52278/week @ 2025-02-13 51309/week @ 2025-02-20 55354/week @ 2025-02-27 57580/week @ 2025-03-06

224,469 downloads per month
Used in 186 crates (70 directly)

MIT/Apache

25KB
540 lines

mac_address

crates.io Released API docs

mac_address provides a cross platform way to retrieve the MAC address of network hardware.

Supported platforms: Linux, Windows, MacOS, FreeBSD, OpenBSD, illumos

Example

use mac_address::get_mac_address;

fn main() {
    match get_mac_address() {
        Ok(Some(ma)) => {
            println!("MAC addr = {}", ma);
            println!("bytes = {:?}", ma.bytes());
        }
        Ok(None) => println!("No MAC address found."),
        Err(e) => println!("{:?}", e),
    }
}

License

mac_address is licensed under both MIT and Apache 2.0


lib.rs:

mac_address provides a cross platform way to retrieve the MAC address of network hardware. See the Wikipedia entry for more information.

Supported platforms: Linux, Windows, MacOS, FreeBSD, NetBSD

Dependencies

~0–710KB
~12K SLoC