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

Function extractIPFromURL

frontend/packages/common/src/utils/ip.ts:1–11  ·  view source on GitHub ↗
(url: string | string[])

Source from the content-addressed store, hash-verified

1export const extractIPFromURL = (url: string | string[]) => {
2 if (Array.isArray(url)) {
3 url = url[0] // 获取第一个 URL
4 }
5 if (typeof url !== 'string' || !url.includes('://')) {
6 console.warn('Invalid URL format')
7 return null
8 }
9 const match = url.match(/https?:\/\/([\d.]+):\d+/)
10 return match ? match[1] : null
11}
12
13export const isPrivateIP = (ip: string) => {
14 if (typeof ip !== 'string') {

Callers 1

IpTypeTagFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected