feat(settings): add setting for Reality scan candidates (#6471)

* feat(settings): allow customizing Reality scan candidate list

Persist a realityScanCandidates panel setting (defaulting to the previous
hardcoded list), expose it in General Settings with i18n, and have the
Find Targets scanner use it when the search box is empty.

Fixes #5847

* style(frontend): oxfmt realityScanCandidates in setting.ts

* Fix locale JSON syntax

This change removes the malformed duplicate key and missing comma in the Android per-app proxy translations across the bundled locale files. The JSON now parses correctly while preserving the translated labels for each language.

* docs(i18n): update Happ translations

Localize the remaining Happ subscription settings strings across the translation files and refine the English copy. This aligns the labels and descriptions with the current Happ behavior for notifications, TUN options, HWID enforcement, routing presets, and per-app proxy settings.

* refactor(reality): drop test-only scaffolding from the candidate setting

TestDefaultRealityScanCandidatesCSV compared the CSV against its own
initializer and a defaultValueMap lookup, and
TestRealityScanCandidateTokensFallsBackWithoutDB drove a no-database
state no production caller reaches (the only caller is the
scanRealityTargets handler, served after InitDB). The
s != nil && GetDB() != nil guard existed only for that second test.
None of them could fail except in lockstep with the code they restate.

* docs(api): describe the setting-driven scanRealityTargets fallback

An empty targets value now probes the realityScanCandidates setting,
but the endpoint summary, parameter description and handler comment
still promised the built-in seed list, so API consumers were told the
wrong target set. Regenerated openapi.json and synced the docs copy,
which also lacked the new AllSetting field in the settings reference.

---------

Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
mrchatam
2026-09-13 16:18:28 +03:30
committed by GitHub
parent bf7ce2daaa
commit 768bbd2a29
29 changed files with 857 additions and 735 deletions

View File

@@ -168,9 +168,10 @@ _openapi:
title: Probe/discover REALITY targets and return each verdict ranked by
feasibility then latency. Each comma-separated token may be a domain
(validated with SNI), a bare IP, or a CIDR range (discovered without SNI
by reading the certificate domain). When empty, a built-in seed list is
probed.
url: '#probediscover-reality-targets-and-return-each-verdict-ranked-by-feasibility-then-latency-each-comma-separated-token-may-be-a-domain-validated-with-sni-a-bare-ip-or-a-cidr-range-discovered-without-sni-by-reading-the-certificate-domain-when-empty-a-built-in-seed-list-is-probed'
by reading the certificate domain). When empty, the
realityScanCandidates setting is probed (the built-in seed list if that
setting is empty).
url: '#probediscover-reality-targets-and-return-each-verdict-ranked-by-feasibility-then-latency-each-comma-separated-token-may-be-a-domain-validated-with-sni-a-bare-ip-or-a-cidr-range-discovered-without-sni-by-reading-the-certificate-domain-when-empty-the-realityscancandidates-setting-is-probed-the-built-in-seed-list-if-that-setting-is-empty'
- depth: 2
title: Fetch the fully aggregated inbound_client_ips database table. Used by
nodes to sync recently active IPs across the cluster.
@@ -304,9 +305,10 @@ _openapi:
- content: Probe/discover REALITY targets and return each verdict ranked by
feasibility then latency. Each comma-separated token may be a domain
(validated with SNI), a bare IP, or a CIDR range (discovered without
SNI by reading the certificate domain). When empty, a built-in seed
list is probed.
id: probediscover-reality-targets-and-return-each-verdict-ranked-by-feasibility-then-latency-each-comma-separated-token-may-be-a-domain-validated-with-sni-a-bare-ip-or-a-cidr-range-discovered-without-sni-by-reading-the-certificate-domain-when-empty-a-built-in-seed-list-is-probed
SNI by reading the certificate domain). When empty, the
realityScanCandidates setting is probed (the built-in seed list if
that setting is empty).
id: probediscover-reality-targets-and-return-each-verdict-ranked-by-feasibility-then-latency-each-comma-separated-token-may-be-a-domain-validated-with-sni-a-bare-ip-or-a-cidr-range-discovered-without-sni-by-reading-the-certificate-domain-when-empty-the-realityscancandidates-setting-is-probed-the-built-in-seed-list-if-that-setting-is-empty
- content: Fetch the fully aggregated inbound_client_ips database table. Used by
nodes to sync recently active IPs across the cluster.
id: fetch-the-fully-aggregated-inbound_client_ips-database-table-used-by-nodes-to-sync-recently-active-ips-across-the-cluster

View File

@@ -162,6 +162,9 @@
"panelOutbound": {
"type": "string"
},
"realityScanCandidates": {
"type": "string"
},
"remarkTemplate": {
"type": "string"
},
@@ -538,6 +541,7 @@
"outboundDownThreshold",
"pageSize",
"panelOutbound",
"realityScanCandidates",
"remarkTemplate",
"restartXrayOnClientDisable",
"sessionMaxAge",
@@ -805,6 +809,9 @@
"panelOutbound": {
"type": "string"
},
"realityScanCandidates": {
"type": "string"
},
"remarkTemplate": {
"type": "string"
},
@@ -1189,6 +1196,7 @@
"outboundDownThreshold",
"pageSize",
"panelOutbound",
"realityScanCandidates",
"remarkTemplate",
"restartXrayOnClientDisable",
"sessionMaxAge",
@@ -7400,7 +7408,7 @@
"tags": [
"Server"
],
"summary": "Probe/discover REALITY targets and return each verdict ranked by feasibility then latency. Each comma-separated token may be a domain (validated with SNI), a bare IP, or a CIDR range (discovered without SNI by reading the certificate domain). When empty, a built-in seed list is probed.",
"summary": "Probe/discover REALITY targets and return each verdict ranked by feasibility then latency. Each comma-separated token may be a domain (validated with SNI), a bare IP, or a CIDR range (discovered without SNI by reading the certificate domain). When empty, the realityScanCandidates setting is probed (the built-in seed list if that setting is empty).",
"operationId": "post_panel_api_server_scanRealityTargets",
"requestBody": {
"required": false,
@@ -7411,7 +7419,7 @@
"properties": {
"targets": {
"type": "string",
"description": "Optional comma-separated tokens: domain[:port], IP[:port], or CIDR (e.g. 104.16.0.0/24). When omitted, a built-in seed list is probed."
"description": "Optional comma-separated tokens: domain[:port], IP[:port], or CIDR (e.g. 104.16.0.0/24). When omitted, the realityScanCandidates setting is probed (the built-in seed list if that setting is empty)."
}
}
}