(ip: string)
| 11 | } |
| 12 | |
| 13 | export 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 | } |