Installations
npm install tauri-plugin-network-api
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
22.11.0
NPM Version
10.9.0
Score
74.3
Supply Chain
98.4
Quality
86.3
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
Rust (85.67%)
TypeScript (12.13%)
JavaScript (2.2%)
Developer
HuakunShen
Download Statistics
Total Downloads
16,759
Last Day
22
Last Week
739
Last Month
4,620
Last Year
16,285
GitHub Statistics
30 Stars
24 Commits
1 Forks
1 Watching
5 Branches
2 Contributors
Bundle Size
8.68 kB
Minified
2.55 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.0.5
Package Id
tauri-plugin-network-api@2.0.5
Unpacked Size
31.42 kB
Size
6.26 kB
File Count
17
NPM Version
10.9.0
Node Version
22.11.0
Publised On
05 Jan 2025
Total Downloads
Cumulative downloads
Total Downloads
16,759
Last day
-83.5%
22
Compared to previous day
Last week
-44.4%
739
Compared to previous week
Last month
444.8%
4,620
Compared to previous month
Last year
3,335.7%
16,285
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
5
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)
Features
- 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)
Installation
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).
1tauri-plugin-network = { git = "https://github.com/HuakunShen/tauri-plugin-network", branch = "main" }
NPM Install
Run the following to install JavaScript/TypeScript API package.
1npm i tauri-plugin-network-api 2# 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
:
1fn main() { 2 tauri::Builder::default() 3 .plugin(tauri_plugin_network::init()) 4 .run(tauri::generate_context!()) 5 .expect("error while running tauri application"); 6}
Third Party Libraries Used
API
TypeScript
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.
Valibot was used to define type schema and infer TypeScript types. You can import the types exported from the npm package.
The exported valibot 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
1import { getInterfaces, NetworkInterface } from "tauri-plugin-network-api"; 2 3function getInterfacesOnClick() { 4 getInterfaces().then((ifaces: Array<Object>) => { 5 const parsed = z.array(NetworkInterface).safeParse(ifaces); 6 if (parsed.success) { 7 data = JSON.stringify(parsed.data, null, 2); 8 } else { 9 error = parsed.error.toString(); 10 } 11 }); 12}
Scanning
1import { 2 isHttpPortOpen, 3 isPortTaken, 4 findAvailablePort, 5 scanOnlineIpPortPairs, 6 scanOnlineIpsByPort, 7 nonLocalhostNetworks, 8 localServerIsRunning, 9 scanLocalNetworkOnlineHostsByPort, 10} from "tauri-plugin-network-api"; 11 12console.log(await is_http_port_open("127.0.0.1", 8000)); 13console.log(await isPortTaken(8000)); 14console.log(await findAvailablePort()); 15console.log( 16 await scanOnlineIpPortPairs([ 17 { ip: "127.0.0.1", port: 8000 }, 18 { ip: "192.168.3.6", port: 8000 }, 19 { ip: "192.168.3.5", port: 8000 }, 20 ]) 21); 22console.log( 23 await scanOnlineIpsByPort(["127.0.0.1", "192.168.3.6", "192.168.1.2"], 8000) 24); 25console.log("Non Localhost Networks", await nonLocalhostNetworks()); 26console.log("Local Server is Running", await localServerIsRunning(8000)); 27console.log( 28 "Scan Local Network for service", 29 await scanLocalNetworkOnlineHostsByPort(8000, "AppName") 30);
Usage
See SvelteKit Example for an example written with SvelteKit.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No security vulnerabilities found.