Skip to content
Open
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
441 changes: 441 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ tracing = { version = "0.1.41", default-features = false, features = ["std", "lo
[target.'cfg(windows)'.dependencies]
windows = { version = "0.62.2", features = ["Networking_Connectivity"] }

[target.'cfg(target_os = "linux")'.dependencies]
zbus = "=5.14.0"

[build-dependencies]
tauri-plugin = { version = "2.5.1", features = ["build"] }
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ decisions.
* Detect connection type (WiFi, Ethernet, Cellular)
* Query metered and constrained status for network policy decisions
* Check internet reachability
* Cross-platform support (Windows, iOS, Android)
* Cross-platform support (Windows, Linux, iOS, Android)

| Platform | Supported |
| -------- | --------- |
| Windows | Yes |
| Linux | Yes |
| macOS | Planned |
| Android | Planned |
| iOS | Planned |
Expand Down Expand Up @@ -68,6 +69,12 @@ Run Rust tests only:
cargo test --workspace --lib
```

### Manual Linux scenario testing

See [Linux Connectivity Manual Testing](docs/linux-connectivity-manual-testing.md)
for WSL2, VirtualBox, NetworkManager, ModemManager, metered, constrained, and
transport-type test scenarios.

## Install

_This plugin requires a Rust version of at least **1.94.0**_
Expand Down Expand Up @@ -180,11 +187,12 @@ The `connectionStatus()` function returns a `ConnectionStatus` object:

#### Platform mapping

| Field | Windows | iOS | Android |
| ---------------- | ----------------------------------------------------------------------------------- | --------------------------- | ---------------------------------- |
| `metered` | `NetworkCostType` Unknown/Fixed/Variable | `NWPath.isExpensive` | absence of `NOT_METERED` |
| `constrained` | `ConstrainedInternetAccess`, data-limit, roaming, or background data restrictions | `NWPath.isConstrained` | Data Saver / `RESTRICT_BACKGROUND` |
| `connectionType` | WWAN/WLAN/IANA interface type | `NWInterface.InterfaceType` | `TRANSPORT_*` capabilities |
| Field | Windows | Linux | iOS | Android |
| ---------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------- | --------------------------- | ---------------------------------- |
| `connected` | `InternetAccess` or `ConstrainedInternetAccess` | NetworkManager `FULL`/`PORTAL` or up default route fallback | `NWPath.status` satisfied | active network with internet capability |
| `metered` | `NetworkCostType` Unknown/Fixed/Variable | NetworkManager primary device `Metered` | `NWPath.isExpensive` | absence of `NOT_METERED` |
| `constrained` | `ConstrainedInternetAccess`, data-limit, roaming, or background data restrictions | NetworkManager portal/metered or cellular roaming; fallback defaults to `false` | `NWPath.isConstrained` | Data Saver / `RESTRICT_BACKGROUND` |
| `connectionType` | WWAN/WLAN/IANA interface type | NetworkManager device type or sysfs fallback | `NWInterface.InterfaceType` | `TRANSPORT_*` capabilities |

## Development Standards

Expand Down
Loading
Loading