Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ netlink-sys = "0.8.8"

[target.'cfg(target_os = "android")'.dependencies]
dlopen2 = { version = "0.8.2", default-features = false }
jni = { version = "0.21.1", optional = true }
ndk-context = { version = "0.1.1", optional = true }
once_cell = "1"

[target.'cfg(windows)'.dependencies.windows-sys]
Expand Down Expand Up @@ -53,9 +55,10 @@ block2 = "0.6"
serde_json = "1.0"

[features]
default = ["gateway", "apple-system-configuration-extra"]
default = ["gateway", "apple-system-configuration-extra", "android-extra"]
serde = ["dep:serde", "mac-addr/serde", "ipnet/serde"]
gateway = []
android-extra = ["dep:jni", "dep:ndk-context"]
apple-system-configuration-extra = [
"objc2-system-configuration/SCPreferences",
"objc2-system-configuration/SCDynamicStore",
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ For more details, see [examples][examples-url] or [doc][doc-url].
- `apple-system-configuration-extra` (default)
- Enables deeper Apple metadata enrichment using `SystemConfiguration` APIs.
- On Apple targets, this adds metadata such as interface display names, DHCP hints, and iOS DNS resolver lookup when the platform exposes them.
- `android-extra` (default)
- Enables deeper Android metadata enrichment using Android platform APIs through JNI bindings.
- On Android, this can add metadata such as traffic stats, DNS servers, DHCP hints, and Wi-Fi link speed when the app provides the required Android context and permissions.

To opt out of the deeper Apple enrichment while keeping gateway helpers:

Expand All @@ -62,6 +65,9 @@ netdev = { version = "0.43", default-features = false, features = ["gateway"] }
`netdev` links `SystemConfiguration.framework` automatically on `macOS` and `iOS` through the crate's own build script.
If your final app link is performed by Xcode, you may still need to add `SystemConfiguration.framework` to the app target manually.

## Android behavior
If you want Android-specific values such as DNS servers, DHCP hints, or Wi-Fi link speed, your app may still need to initialize the Android context for Rust and declare Android permissions such as `ACCESS_NETWORK_STATE` and `ACCESS_WIFI_STATE`.

## Project History
This crate was originally published as [default-net][default-net-crates-io-url]
and later rebranded to `netdev` by the author myself for future expansion, clearer naming, and long-term maintenance.
Expand Down
Loading
Loading