MCPcopy Index your code
hub / github.com/nodejs/node / addSubnet

Method addSubnet

lib/internal/blocklist.js:109–129  ·  view source on GitHub ↗
(network, prefix, family = 'ipv4')

Source from the content-addressed store, hash-verified

107 }
108
109 addSubnet(network, prefix, family = 'ipv4') {
110 if (!SocketAddress.isSocketAddress(network)) {
111 validateString(network, 'network');
112 validateString(family, 'family');
113 network = new SocketAddress({
114 address: network,
115 family,
116 });
117 }
118 switch (network.family) {
119 case 'ipv4':
120 validateInt32(prefix, 'prefix', 0, 32);
121 break;
122 case 'ipv6':
123 validateInt32(prefix, 'prefix', 0, 128);
124 break;
125 }
126 // Coerce -0 to +0.
127 prefix += 0;
128 this[kHandle].addSubnet(network[kSocketAddressHandle], prefix);
129 }
130
131 check(address, family = 'ipv4') {
132 if (!SocketAddress.isSocketAddress(address)) {

Callers 3

#parseIPInfoMethod · 0.95
test-blocklist.jsFile · 0.80

Calls 1

isSocketAddressMethod · 0.80

Tested by

no test coverage detected