@arcanewizards/net-utils 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# `@arcanewizards/net-utils`
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@arcanewizards/net-utils)
|
|
4
|
+
|
|
5
|
+
Small Node.js networking helpers shared by the Arcane Wizards packages.
|
|
6
|
+
|
|
7
|
+
The package currently focuses on IPv4 interface discovery and common connection-status types used by higher-level transport packages such as `@arcanewizards/artnet` and `@arcanewizards/tcnet`.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @arcanewizards/net-utils
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Node.js `>=22.12.0 || >=23.1.0`
|
|
18
|
+
|
|
19
|
+
## Exports
|
|
20
|
+
|
|
21
|
+
- `getNetworkInterfaces()`
|
|
22
|
+
Returns a map of IPv4 interfaces keyed by interface name.
|
|
23
|
+
- `ConnectionConfig`
|
|
24
|
+
Shared target shape for host-based and interface-based network configuration.
|
|
25
|
+
- `NetworkInterface`
|
|
26
|
+
Describes a resolved IPv4 interface, including its broadcast address.
|
|
27
|
+
- `NetworkPortStatus`
|
|
28
|
+
Describes runtime status for a network port or range.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { getNetworkInterfaces } from '@arcanewizards/net-utils';
|
|
34
|
+
|
|
35
|
+
const interfaces = await getNetworkInterfaces();
|
|
36
|
+
|
|
37
|
+
for (const [name, iface] of Object.entries(interfaces)) {
|
|
38
|
+
console.log(name, iface.address, iface.broadcastAddress);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Return Shape
|
|
43
|
+
|
|
44
|
+
Each entry returned by `getNetworkInterfaces()` includes:
|
|
45
|
+
|
|
46
|
+
- `name`
|
|
47
|
+
- `address`
|
|
48
|
+
- `internal`
|
|
49
|
+
- `broadcastAddress`
|
|
50
|
+
|
|
51
|
+
Only IPv4 addresses are included.
|