@arcanewizards/net-utils 0.1.1 → 0.1.3
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/LICENSE +21 -0
- package/README.md +51 -0
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arcane Wizards Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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.
|