https://github.com/flier/rust-manuf
Ethernet vendor codes, and well-known MAC addresses
https://github.com/flier/rust-manuf
Last synced: over 1 year ago
JSON representation
Ethernet vendor codes, and well-known MAC addresses
- Host: GitHub
- URL: https://github.com/flier/rust-manuf
- Owner: flier
- License: mit
- Created: 2018-08-09T11:49:44.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-20T11:04:03.000Z (about 6 years ago)
- Last Synced: 2025-03-24T07:13:58.022Z (over 1 year ago)
- Language: Rust
- Size: 635 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-manuf [](LICENSE) [](https://crates.io/crates/manuf) [](https://docs.rs/manuf/) [](https://travis-ci.org/flier/rust-manuf) [](https://codecov.io/gh/flier/rust-manuf)
`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`:
```toml
[dependencies]
manuf = "0.2"
```
Use `vendor` function to find name and description base on an ethernet (MAC) address.
```rust
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.
```rust
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.
```rust
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](src/manuf) file was generated by [the Wireshark project](https://github.com/wireshark/wireshark/blob/master/manuf).
If you want to use the latest version of `manuf` file, please add the `latest` feature.
```toml
[dependencies]
manuf = { version = "0.2", features = ["latest"] }
```
## License
Released under the terms of the MIT license.