diff options
| author | Matain <[email protected]> | 2022-06-08 23:40:42 +0800 |
|---|---|---|
| committer | Matain <[email protected]> | 2022-06-08 23:40:42 +0800 |
| commit | 68c6be4359f3b37fe71d89357f581567ecd40e12 (patch) | |
| tree | 0765d3f0215f593bc2bfcc0421ba1171204058f2 /src/api | |
| parent | 91bfabd5d231df21003f09f49e897b9a5bfc57d7 (diff) | |
add the groupproxy delay test(maybe a little question)
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/proxies.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/api/proxies.ts b/src/api/proxies.ts index 638cddf..3283449 100644 --- a/src/api/proxies.ts +++ b/src/api/proxies.ts @@ -1,4 +1,5 @@ import { getURLAndInit } from '../misc/request-helper'; + const endpoint = '/proxies'; /* @@ -41,6 +42,17 @@ export async function requestDelayForProxy( return await fetch(fullURL, init); } +export async function requestDelayForProxyGroup( + apiConfig, + name, + latencyTestUrl = 'http://www.gstatic.com/generate_202' + ) { + const {url, init } = getURLAndInit(apiConfig); + const qs = `url=${latencyTestUrl}&timeout=2000`; + const fullUrl = `${url}/group/${encodeURIComponent(name)}/delay?${qs}`; + return await fetch(fullUrl,init); +} + export async function fetchProviderProxies(config) { const { url, init } = getURLAndInit(config); const res = await fetch(url + '/providers/proxies', init); |
