How to use the fromPrefixLen function from ip

Find comprehensive JavaScript ip.fromPrefixLen code examples handpicked from public code repositorys.

150
151
152
153
154
155
156
157
158
159
//console.log(pool, "pool");
let arrayips = pool.split(';').filter(item => {return item != ""});
console.log(arrayips, "arrayips");
let i = 0;
let str = cidr.split('/');  //网络号+网络段位数
let mask = ip.fromPrefixLen(str[1])        
let ipnot = ip.not(mask);
let networkIP = ip.cidr(cidr);
let broadcaseIP = ip.or(str[0], ipnot);
console.log(ipnot, networkIP, broadcaseIP);
fork icon1
star icon1
watch icon1

389
390
391
392
393
394
395
396
397

  var addr = cidrParts[0];
  if (cidrParts.length !== 2)
    throw new Error('invalid CIDR subnet: ' + addr);

  var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10));

  return ip.mask(addr, mask);
};
fork icon0
star icon0
watch icon1

+ 2 other calls in file

77
78
79
80
81
82
83
84
85
86

$('#hostForm').submit(function(ev) {
  ev.preventDefault();

  var hostName = $('#hostName').val(),
      subnetMask = ip.fromPrefixLen($('#prefixLen').val()),
      gw = $('#gateway').val();

  var spec = { hn: hostName, sm: subnetMask, gw: gw };
  location.hash = encodeURIComponent(
fork icon0
star icon0
watch icon2

13
14
15
16
17
18
19
20
21
22
}

connect() {
    return new Promise((resolve, reject) => {
        this.evilScanner = new evilscan({
            target: `${ip.mask(uuidModule.getMainNetworkInterface().address, ip.fromPrefixLen(24))}/24`,
            port: '1883',
            status: 'O',
        }, (err, scan) => {
            if (err) {
fork icon0
star icon0
watch icon5