#address #networking #interface #mac

mac_address

Cross-platform retrieval of a network interface MAC address

18 releases (stable)

1.1.7 May 22, 2024
1.1.5 May 25, 2023
1.1.4 Sep 20, 2022
1.1.3 Jan 24, 2022
0.8.0 Jul 21, 2018

#294 in Network programming

Download history 27192/week @ 2024-04-04 27525/week @ 2024-04-11 26205/week @ 2024-04-18 24391/week @ 2024-04-25 26293/week @ 2024-05-02 23684/week @ 2024-05-09 21440/week @ 2024-05-16 19934/week @ 2024-05-23 21737/week @ 2024-05-30 20568/week @ 2024-06-06 21073/week @ 2024-06-13 20316/week @ 2024-06-20 22877/week @ 2024-06-27 22135/week @ 2024-07-04 22807/week @ 2024-07-11 17436/week @ 2024-07-18

89,312 downloads per month
Used in 105 crates (63 directly)

MIT/Apache

24KB
537 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

Dependencies

~0–730KB
~13K SLoC