From 4ac43e692cea4682179612e7fecb4c159e96c039 Mon Sep 17 00:00:00 2001 From: Olivi Date: Sat, 13 Dec 2025 11:40:54 +0000 Subject: feat: add healthcheck functionality for specified proxy --- src/api/proxies.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/api') 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 + ); +} -- cgit v1.3.1