MCPcopy Index your code
hub / github.com/simstudioai/sim / isPrivateIPv4

Function isPrivateIPv4

apps/sim/app/api/tools/zoominfo/shared.ts:55–68  ·  view source on GitHub ↗
(host: string)

Source from the content-addressed store, hash-verified

53])
54
55function isPrivateIPv4(host: string): boolean {
56 const match = host.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
57 if (!match) return false
58 const octets = match.slice(1, 5).map(Number) as [number, number, number, number]
59 if (octets.some((o) => o < 0 || o > 255)) return false
60 const [a, b] = octets
61 if (a === 10) return true
62 if (a === 172 && b >= 16 && b <= 31) return true
63 if (a === 192 && b === 168) return true
64 if (a === 127) return true
65 if (a === 169 && b === 254) return true
66 if (a === 0) return true
67 return false
68}
69
70export function assertSafeZoomInfoUrl(rawUrl: string, label: string): URL {
71 let parsed: URL

Callers 1

assertSafeZoomInfoUrlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected