fix(outbounds): test subscriptions in Test All, skip direct/dns

Test All only iterated the editable template outbounds, so subscription
outbounds (the read-only "from subscriptions" table) were never probed in
bulk. They are now queued too, keyed by tag in subscriptionTestStates so
their rows light up live; the template and subscription HTTP lanes run
serially to respect the backend's single-batch lock (TCP runs alongside).

Also stop testing freedom ("direct") and dns outbounds: they aren't
proxies, so an HTTP probe through them only measures the host's own
reachability, not a tunnel. They are now untestable in every mode -- the
per-row button is disabled and Test All skips them -- with a matching
backend guard so a direct API caller can't HTTP-test them either.
This commit is contained in:
MHSanaei
2026-06-13 11:48:02 +02:00
parent 2d6dea4bf6
commit 1c0fdb4527
6 changed files with 79 additions and 23 deletions
@@ -110,7 +110,7 @@ export default function OutboundCardList({
shape="circle"
size="small"
loading={isTesting(outboundTestStates, index)}
disabled={isUntestable(record, testMode) || isTesting(outboundTestStates, index)}
disabled={isUntestable(record) || isTesting(outboundTestStates, index)}
icon={<ThunderboltOutlined />}
onClick={() => onTest(index, testMode)}
/>
@@ -110,7 +110,7 @@ export default function SubscriptionOutbounds({
shape="circle"
size={isMobile ? 'small' : undefined}
loading={isTesting(subscriptionTestStates, key)}
disabled={!record.tag || isUntestable(record, testMode) || isTesting(subscriptionTestStates, key)}
disabled={!record.tag || isUntestable(record) || isTesting(subscriptionTestStates, key)}
icon={<ThunderboltOutlined />}
onClick={() => onTestSubscription(record as unknown as Record<string, unknown>, testMode)}
/>
@@ -31,10 +31,13 @@ export function outboundAddresses(o: OutboundRow): string[] {
}
}
export function isUntestable(o: OutboundRow, mode: string): boolean {
export function isUntestable(o: OutboundRow): boolean {
if (!o) return true;
if (o.protocol === Protocols.Blackhole || o.protocol === Protocols.Loopback || o.tag === 'blocked') return true;
if (mode === 'tcp' && (o.protocol === Protocols.Freedom || o.protocol === Protocols.DNS)) return true;
// freedom ("direct") and dns aren't proxies — a TCP dial has no endpoint and
// an HTTP probe would only measure the host's own direct reachability, so
// they're untestable in every mode.
if (o.protocol === Protocols.Freedom || o.protocol === Protocols.DNS) return true;
return false;
}
@@ -172,7 +172,7 @@ export function useOutboundColumns({
type="primary"
shape="circle"
loading={isTesting(outboundTestStates, index)}
disabled={isUntestable(record, testMode) || isTesting(outboundTestStates, index)}
disabled={isUntestable(record) || isTesting(outboundTestStates, index)}
icon={<ThunderboltOutlined />}
onClick={() => onTest(index, testMode)}
/>