MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / isValidIPv4

Function isValidIPv4

bgp/bgp.ts:43–50  ·  view source on GitHub ↗
(ip: string)

Source from the content-addressed store, hash-verified

41 return Number.isInteger(n) && n >= 0 && n <= 255;
42 });
43}
44
45function networkAddress(ip: string, mask: number): string | null {
46 if (!isValidIPv4(ip)) return null;
47
48 const parts = ip.split(".").map((p) => Number(p));
49 const ipNum =
50 (((parts[0] << 24) |
51 (parts[1] << 16) |
52 (parts[2] << 8) |
53 parts[3]) >>> 0);

Callers 4

networkAddressFunction · 0.70
normalizeIPFunction · 0.70
fetchBgpSvgWithFallbackFunction · 0.70
fetchDnsWithFallbackFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected