feat: add configurable chain proxy support - #2296
Open
Kou-JunHao wants to merge 9 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds opt-in “chain proxy” support across the Flutter app and Go core, enabling users to define multi-hop proxy routes (including profile/proxy-provider nodes and reusable SOCKS5/HTTP/HTTPS endpoints), route the final MATCH through a stable internal selector, and persist/validate the feature’s configuration.
Changes:
- Introduces persisted chain-proxy configuration (saved proxy endpoints + chain nodes) and integrates it into profile generation (
MATCHrouting + generated dialer chains). - Adds UI flows to enable/disable chain proxy and manage saved proxy nodes / proxy chains, with locale-independent internal identity and localized display.
- Extends the core external provider contract to include an explicit
proxieslist and updates tests/contracts accordingly.
Reviewed changes
Copilot reviewed 43 out of 55 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/providers/config_test.dart | Updates provider override expectations for new chain-proxy config fields. |
| test/providers/action_test.dart | Adds coverage for updating only the selected chain route in selectedMap. |
| test/models/core_test.dart | Verifies ExternalProvider JSON includes proxies. |
| test/models/config_test.dart | Covers Config roundtrip for chainProxyEnabled and savedProxies. |
| test/enum/enum_test.dart | Adds parsing/flags coverage for GroupType.Relay. |
| test/database/generated_contract_test.dart | Updates drift contract expectations for new chainNodes column. |
| test/database/converter_test.dart | Adds roundtrip test for ChainProxyNodeListConverter. |
| test/core/protocol_contract_test.dart | Extends protocol contract tests to include provider proxies. |
| test/common/task_test.dart | Adds extensive tests for relay→dialer chain conversion and MATCH routing behavior. |
| lib/views/proxies/tab.dart | Displays localized name for internal chain-proxy group. |
| lib/views/proxies/proxies.dart | Adds enable/disable toggle + manager FAB and rollback-on-failure apply flow. |
| lib/views/proxies/list.dart | Adds “manage chain proxy” entry point when viewing the internal chain group. |
| lib/views/proxies/common.dart | Introduces helper to localize the chain-proxy internal group name. |
| lib/views/proxies/card.dart | Routes selection updates through proxiesActionProvider helper method. |
| lib/views/profiles/overwrite/custom/proxies.dart | Adjusts custom proxy target selection behavior for Relay groups. |
| lib/views/profiles/overwrite/custom/groups.dart | Localizes Relay label and adds Relay-specific validation / UI gating. |
| lib/providers/state.dart | Ensures Relay chain groups are loaded for non-custom overwrite modes. |
| lib/providers/generated/state.g.dart | Regenerates provider hash after setup state changes. |
| lib/providers/generated/config.g.dart | Adds generated providers for chainProxyEnabled and savedProxies. |
| lib/providers/generated/action.g.dart | Regenerates provider hashes for action changes. |
| lib/providers/config.dart | Adds Riverpod notifiers for chainProxyEnabled and savedProxies and wires into Config. |
| lib/providers/actions/setup.dart | Threads chain-proxy settings into profile build and adds validation helper. |
| lib/providers/actions/proxies.dart | Adds updateSelectedProxyMap helper delegating to ProfilesAction. |
| lib/providers/actions/profiles.dart | Refactors selectedMap updates to support batch updates/removals and equality short-circuit. |
| lib/providers/actions/backup.dart | Restores chainProxyEnabled and savedProxies from backup. |
| lib/models/state.dart | Extends MakeRealProfileState with chain-proxy inputs used by profile generation. |
| lib/models/generated/state.freezed.dart | Regenerated Freezed output for updated MakeRealProfileState. |
| lib/models/generated/core.g.dart | Updates JSON codec for ExternalProvider.proxies. |
| lib/models/generated/core.freezed.dart | Regenerates Freezed output for ExternalProvider.proxies. |
| lib/models/generated/config.g.dart | Adds JSON codec for SavedProxy and new Config fields. |
| lib/models/generated/config.freezed.dart | Regenerates Freezed output for SavedProxy + new Config fields. |
| lib/models/generated/clash_config.g.dart | Adds JSON codec for ChainProxyNode and ProxyGroup.chainNodes. |
| lib/models/generated/clash_config.freezed.dart | Regenerates Freezed output for chain nodes on ProxyGroup. |
| lib/models/core.dart | Adds proxies to ExternalProvider model (default empty). |
| lib/models/config.dart | Adds SavedProxy model and new Config fields. |
| lib/models/clash_config.dart | Adds ChainProxyNode model and ProxyGroup chainNodes. |
| lib/l10n/l10n.dart | Adds localization keys for chain proxy manager UI and validation messages. |
| lib/l10n/intl/messages_zh_CN.dart | Adds zh_CN translations for new chain proxy strings. |
| lib/l10n/intl/messages_ru.dart | Adds ru translations for new chain proxy strings. |
| lib/l10n/intl/messages_ja.dart | Adds ja translations for new chain proxy strings. |
| lib/l10n/intl/messages_en.dart | Adds en translations for new chain proxy strings. |
| lib/database/groups.dart | Adds chainNodes column + DAO helpers for querying chain groups. |
| lib/database/generated/database.g.dart | Regenerates drift schema/models for new column and converters. |
| lib/database/database.dart | Bumps schemaVersion and migrates proxy_groups with chain_nodes column. |
| lib/database/converter.dart | Adds JSON converter for storing chain node lists in drift. |
| lib/common/tray.dart | Uses localized chain group label + routes selections via proxies action helper. |
| lib/common/task.dart | Implements chain proxy group application: chain generation, provider isolation, MATCH routing. |
| lib/common/constant.dart | Introduces internal chain-proxy group constant. |
| core/constant.go | Extends core ExternalProvider struct to include Proxies. |
| core/common.go | Populates ExternalProvider proxy names list from ProxySetProvider. |
| arb/intl_zh_CN.arb | Adds ARB keys/translations for chain proxy features (zh_CN). |
| arb/intl_ru.arb | Adds ARB keys/translations for chain proxy features (ru). |
| arb/intl_ja.arb | Adds ARB keys/translations for chain proxy features (ja). |
| arb/intl_en.arb | Adds ARB keys/translations for chain proxy features (en). |
Files not reviewed (1)
- lib/l10n/l10n.dart: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+269
to
+270
| if (proxyGroup.type == GroupType.Relay && | ||
| (proxyGroup.proxies?.length ?? 0) < 2) { |
Comment on lines
+312
to
+315
| proxyGroups.any( | ||
| (item) => | ||
| item.type != GroupType.Relay && item.name == chainProxyGroupName, | ||
| ); |
chen08209
force-pushed
the
dev
branch
3 times, most recently
from
August 15, 2026 11:41
8179499 to
d966b18
Compare
chen08209
force-pushed
the
dev
branch
7 times, most recently
from
September 1, 2026 01:44
7748c64 to
e17fe6d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
flutter analyze --no-fatal-infosflutter test --reporter expanded(726 tests)CGO_ENABLED=0 go test .CGO_ENABLED=0 go vet .