https://github.com/nodef/extra-net
Support methods for Net module.
https://github.com/nodef/extra-net
address extra free ip method module net public support utility
Last synced: 3 months ago
JSON representation
Support methods for Net module.
- Host: GitHub
- URL: https://github.com/nodef/extra-net
- Owner: nodef
- License: bsd-3-clause
- Created: 2019-04-05T08:22:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-29T07:46:21.000Z (7 months ago)
- Last Synced: 2024-12-27T21:19:29.403Z (4 months ago)
- Topics: address, extra, free, ip, method, module, net, public, support, utility
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/extra-net
- Size: 43.9 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Support methods for [Net module].
> - Need machine's public IP address?
> - Need a free port for container?```javascript
const net = require('extra-net');var {family, address} = net.address();
// family: 'IPv4', address: '192.168.1.7'var port = await net.freePort();
// port: 37567
```## reference
```javascript
const net = require('extra-net');
// : includes all functions of "net"net.address([options]);
options = {
internal: Boolean, // true | false (default)
address: String, // 'IPv4' | 'IPv6'
netmask: String, // e.g., '255.255.255.0'
}
-> {address, netmask, family, mac, internal, cidr}net.freePort([host]);
host = String // e.g., '127.0.0.1'
-> Promise port
```[Net module]: https://nodejs.org/api/net.html