tauri-plugin-network 2.0.2

A tauri plugin for retrieving system info
docs.rs failed to build tauri-plugin-network-2.0.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: tauri-plugin-network-0.1.2

Tauri Plugin network

API Documentation: https://huakunshen.github.io/tauri-plugin-network/

This is a Tauri plugin for reading network interface information and scanning network.

  • Tauri v1 support on branch v1 (package version 1.x)
  • Tauri v2 support on branch v2 (package version 2.x)


  • Retrieve network interface information
  • TCP host up detection
  • Scan local network ips on specified port using HTTP
    • With optional response keyword detection
    • Batch scanning with multi-threading
  • ICMP scan
  • Network data transmission monitoring
  • Packet sniffing (This is harder on Windows as pnet on Windows requires installation of WinPcap or npcap)


If you are installing from npm and crate.io package registry, make sure the versions for both packages are the same, otherwise, the API may not match.

Rust Install

cargo add tauri-plugin-network to add the package.

Or add the following to your Cargo.toml for the latest unpublished version (not recommanded).

tauri-plugin-network = { git = "https://github.com/HuakunShen/tauri-plugin-network", branch = "main" }

NPM Install

Run the following to install JavaScript/TypeScript API package.

npm i tauri-plugin-network-api
# npm add https://github.com/HuakunShen/tauri-plugin-network # or this for latest unpublished version (not recommended)

In main.rs, add the following to your tauri::Builder:

fn main() {
        .expect("error while running tauri application");

Third Party Libraries Used



All TypeScript APIs can be found in api.ts.

Return type of each API is added. The object structures can be found in types.ts.

Zod was used to define type schema and infer TypeScript types. You can import the types exported from the npm package.

The exported zod schemas can be used to parse data and make sure the data returned from rust APIs match the desired structure defined in schema.

Get Interface Info

import { getInterfaces, NetworkInterface } from "tauri-plugin-network-api";

function getInterfacesOnClick() {
  getInterfaces().then((ifaces: Array<Object>) => {
    const parsed = z.array(NetworkInterface).safeParse(ifaces);
    if (parsed.success) {
      data = JSON.stringify(parsed.data, null, 2);
    } else {
      error = parsed.error.toString();


import {
} from "tauri-plugin-network-api";

console.log(await is_http_port_open("", 8000));
console.log(await isPortTaken(8000));
console.log(await findAvailablePort());
  await scanOnlineIpPortPairs([
    { ip: "", port: 8000 },
    { ip: "", port: 8000 },
    { ip: "", port: 8000 },
  await scanOnlineIpsByPort(["", "", ""], 8000)
console.log("Non Localhost Networks", await nonLocalhostNetworks());
console.log("Local Server is Running", await localServerIsRunning(8000));
  "Scan Local Network for service",
  await scanLocalNetworkOnlineHostsByPort(8000, "AppName")


See SvelteKit Example for an example written with SvelteKit.