diff options
| author | Olivi <[email protected]> | 2025-12-13 11:40:54 +0000 |
|---|---|---|
| committer | Olivi <[email protected]> | 2025-12-13 11:40:54 +0000 |
| commit | 4ac43e692cea4682179612e7fecb4c159e96c039 (patch) | |
| tree | 504322c2fbc1893ff8cab233075d1d629dd54962 /src/api | |
| parent | 3959e45747aabe9ec3dea011f66851d8c219a5fb (diff) | |
feat: add healthcheck functionality for specified proxy
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/proxies.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/api/proxies.ts b/src/api/proxies.ts index 0b98bd0..302014c 100644 --- a/src/api/proxies.ts +++ b/src/api/proxies.ts @@ -1,4 +1,5 @@ import { getURLAndInit } from '../misc/request-helper'; +import { ClashAPIConfig } from '../types'; const endpoint = '/proxies'; @@ -76,3 +77,18 @@ export async function healthcheckProviderByName(config, name) { options ); } + +export async function healthcheckProviderProxy( + config: ClashAPIConfig, + providerName: string, + proxyName: string +) { + const { url, init } = getURLAndInit(config); + const options = { ...init, method: 'GET' }; + return await fetch( + `${url}/providers/proxies/${encodeURIComponent(providerName)}/${encodeURIComponent( + proxyName + )}/healthcheck`, + options + ); +} |
