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

Function normalizeIP

bgp/bgp.ts:75–83  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

73 const ip = m[1];
74 if (!isValidIPv4(ip)) return null;
75 return ip;
76}
77
78function extractIPFromText(text: string): string | null {
79 const cidrLike = /(\d{1,3}(?:\.\d{1,3}){3})\/\d{1,2}/;
80 const m1 = cidrLike.exec(text);
81 if (m1) {
82 const ip = normalizeIP(m1[1]);
83 if (ip) return ip;
84 }
85
86 const ipRegex = /(\d{1,3}(?:\.\d{1,3}){3})/;

Callers 1

extractIPFromTextFunction · 0.85

Calls 1

isValidIPv4Function · 0.70

Tested by

no test coverage detected