How to use the cidr function from ip

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

41
42
43
44
45
46
47
48
49
50
        addr
    };
}

try {
    ip.cidr(addr);
    return {
        kind: 'CIDR',
        addr
    };
fork icon68
star icon227
watch icon0

+ 2 other calls in file

152
153
154
155
156
157
158
159
160
161
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);
for (i = 0; i < arrayips.length; i++) {
    let lineips = arrayips[i].split(',');
fork icon1
star icon1
watch icon1

46
47
48
49
50
51
52
53
54
55
addField('GW:', ip.or(subnet.networkAddress, spec.gw));

n = 0;
for(i in DNS_SERVERS) {
  var r = DNS_SERVERS[i];
  var cidr = ip.cidr(data.ip + '/' + r.prefixLen);
  if(cidr == r.cidr) {
    n += 1;
    addField('DNS' + n + ':', r.server);
  }
fork icon0
star icon0
watch icon2

+ 3 other calls in file