#ethernet #mac #vendor #mac-address

manuf

Ethernet vendor codes, and well-known MAC addresses

3 unstable releases

0.2.0 May 20, 2020
0.1.1 Aug 10, 2018
0.1.0 Aug 9, 2018

#9 in #vendor

Download history 77/week @ 2024-02-10 92/week @ 2024-02-17 82/week @ 2024-02-24 74/week @ 2024-03-02 120/week @ 2024-03-09 36/week @ 2024-03-16 33/week @ 2024-03-23 85/week @ 2024-03-30 42/week @ 2024-04-06 31/week @ 2024-04-13 73/week @ 2024-04-20 21/week @ 2024-04-27 8/week @ 2024-05-04 12/week @ 2024-05-11 55/week @ 2024-05-18 20/week @ 2024-05-25

96 downloads per month

MIT license

530KB
172 lines

rust-manuf LICENSE Crates.io Version Document Build Status Codecov

rust-manuf is a Rust library provides the Ethernet vendor codes, and well-known MAC addresses

Usage

To use rust-manuf, add this to your Cargo.toml:

[dependencies]
manuf = "0.2"

Use vendor function to find name and description base on an ethernet (MAC) address.

assert_eq!(
    manuf::vendor([0x8c, 0x85, 0x90, 0x0b, 0xcb, 0x9e]),
    Some(("Apple", "Apple, Inc."))
);

Use prefix function to find vendor's prefix and mask for the ethernet (MAC) address.

assert!(
    manuf::prefix("Apple")
        .any(|prefix| prefix == ([0x8c, 0x85, 0x90, 0x00, 0x00, 0x00], 24))
);

use parse function to extract verdor's ((prefix, prefix_length), (name, description)) from a manuf file.

let f = File::open("manuf").unwrap();
let r = BufReader::new(f);

for ((prefix, prefix_len), (name, desc)) in manuf::parse(r) {
    println!("{:?}/{}\t{}\t{}", prefix, prefix_len, name, desc)
}

Note: The manuf file was generated by the Wireshark project.

If you want to use the latest version of manuf file, please add the latest feature.

[dependencies]
manuf = { version = "0.2", features = ["latest"] }

License

Released under the terms of the MIT license.

Dependencies