Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 762 Bytes

README.md

File metadata and controls

43 lines (27 loc) · 762 Bytes

Support methods for Net module.

  • Need machine's public IP address?
  • Need a free port for container?
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

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