| 1 | import requestNet from './requestNet'; |
| 2 | |
| 3 | // 代理地址有效性检测 |
| 4 | export async function proxyCheck(proxy: string) { |
| 5 | try { |
| 6 | const res = await requestNet({ |
| 7 | url: 'https://httpbin.org/ip', |
| 8 | method: 'GET', |
| 9 | proxy, |
| 10 | }); |
| 11 | console.log(res); |
| 12 | if (res.status === 200 || res.status === 201 || res.data.length > 100000) { |
| 13 | return true; |
| 14 | } |
| 15 | return false; |
| 16 | } catch (e) { |
| 17 | console.log(e); |
| 18 | return false; |
| 19 | } |
| 20 | } |
| 21 |