Skip to content

Cross-platform retrieval of a network interface MAC address.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE2.0
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

devnought/mac_address

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Examples

Get first non-loopback address

extern crate mac_address;

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),
    }
}

Iterate over all MAC addresses

extern crate mac_address;

use mac_address::MacAddresses;

fn main() {
    let addresses = MacAddresses::new().unwrap();

    for address in addresses {
        println!("{}", address)
    }
}

License

mac_address is licensed under both MIT and Apache 2.0

About

Cross-platform retrieval of a network interface MAC address.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE2.0
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%