The network module queries the machine's network egress:
getLocalIpv4() (primary interface IPv4), getLocalIpv6() (primary
interface IPv6), getPublicIp() (public IPv4, null when offline or the
service is unreachable). All three are plain command invocations backed by
plugin:network|* (a port of tauri-plugin-network).
The main entry re-exports
network.getLocalIpv4under the namegetNetworkIpv4to avoid clashing with thelocal-ipmodule'sgetLocalIpv4; the@zturnlibs/ztron-api/networksubpath keeps the original name.
Permissions: network:allow-get-local-ipv4,
network:allow-get-local-ipv6, network:allow-get-public-ip; collected
in the network:default set. No scope — the plugin is constructed
with no arguments. From examples/hello/src/main.ts:
The matching capability entry is "network:default".
From examples/hello/frontend/src/main.ts (the anchor NETWORK_OK is
its real run output; IPv4 is asserted deterministically, IPv6/public are
recorded as best-effort info):
All three functions resolve string | null — they never throw on network
issues, they hand back null instead, so callers should treat the values
as optional.
plugin:network|* totals 3 commands:
| Command | API |
|---|---|
get_local_ipv4 |
getLocalIpv4() |
get_local_ipv6 |
getLocalIpv6() |
get_public_ip |
getPublicIp() |
Full list in the Commands Reference and the API symbol reference.
Applicable version: ztron 0.3.1