(url: string | string[])
| 1 | export 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 | |
| 13 | export const isPrivateIP = (ip: string) => { |
| 14 | if (typeof ip !== 'string') { |