(args: string[])
| 52 | return arg; |
| 53 | } |
| 54 | } |
| 55 | return null; |
| 56 | } |
| 57 | |
| 58 | function isValidIPv4(ip: string): boolean { |
| 59 | const ipv4Regex = |
| 60 | /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; |
| 61 | return ipv4Regex.test(ip); |
| 62 | } |
| 63 | |
| 64 | async function getIpLocation(ip: string): Promise<string> { |
| 65 | try { |
| 66 | const response = await axios.get(`https://api.ip.sb/geoip/${ip}`, { |
| 67 | timeout: 3000, |
| 68 | headers: { |
| 69 | "User-Agent": "TeleBox-DNS-Plugin/1.0", |
no outgoing calls
no test coverage detected