| 409 | } |
| 410 | |
| 411 | async function checkConnection(target) { |
| 412 | const controller = new AbortController(); |
| 413 | const timeoutId = setTimeout(() => controller.abort(), 4000); |
| 414 | |
| 415 | try { |
| 416 | const response = await fetch(target, { signal: controller.signal }); |
| 417 | clearTimeout(timeoutId); |
| 418 | |
| 419 | if (!response.ok) { |
| 420 | throw new Error("Network response was not ok"); |
| 421 | } |
| 422 | |
| 423 | return response; |
| 424 | } catch (error) { |
| 425 | clearTimeout(timeoutId); |
| 426 | throw error; |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | window.checkall = async function () { |
| 431 | const proxies = [ |