MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / isPrivateIP

Function isPrivateIP

frontend/packages/common/src/utils/ip.ts:13–21  ·  view source on GitHub ↗
(ip: string)

Source from the content-addressed store, hash-verified

11}
12
13export const isPrivateIP = (ip: string) => {
14 if (typeof ip !== 'string') {
15 console.error('Invalid IP format')
16 return false
17 }
18 const privateIpRegex =
19 /^(10\.\d{1,3}\.\d{1,3}\.\d{1,3})$|^(172\.(1[6-9]|2[0-9]|3[0-1])\.\d{1,3}\.\d{1,3})$|^(192\.168\.\d{1,3}\.\d{1,3})$/
20 return privateIpRegex.test(ip)
21}

Callers 1

IpTypeTagFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected