Skip to content

Commit

Permalink
Add support for illumos (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmooney authored May 22, 2024
1 parent 604aa4f commit 2c9aeb4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["mac", "address", "network", "interface"]
[dependencies]
serde = { version = "1.0.198", features = ["derive"], optional = true }

[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "android"))'.dependencies]
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "android", target_os = "illumos"))'.dependencies]
nix = { version = "0.28", features = ["net"] }

[target.'cfg(windows)'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

`mac_address` provides a cross platform way to retrieve the [MAC address](https://en.wikipedia.org/wiki/MAC_address) of network hardware.

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

## Example

Expand Down
3 changes: 3 additions & 0 deletions examples/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ fn main() {
#[cfg(target_os = "android")]
let name = "wlan0";

#[cfg(target_os = "illumos")]
let name = "igb0";

match mac_address_by_name(name) {
Ok(Some(ma)) => {
println!("MAC addr of {} = {}", name, ma);
Expand Down
1 change: 1 addition & 0 deletions src/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod internal;
target_os = "freebsd",
target_os = "openbsd",
target_os = "android",
target_os = "illumos",
))]
#[path = "linux.rs"]
mod internal;
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod os;
target_os = "freebsd",
target_os = "openbsd",
target_os = "android",
target_os = "illumos",
))]
#[path = "linux.rs"]
mod os;
Expand All @@ -38,6 +39,7 @@ pub enum MacAddressError {
target_os = "freebsd",
target_os = "openbsd",
target_os = "android",
target_os = "illumos",
))]
impl From<nix::Error> for MacAddressError {
fn from(_: nix::Error) -> MacAddressError {
Expand Down

0 comments on commit 2c9aeb4

Please sign in to comment.