Skip to content

feat: add configurable chain proxy support - #2296

Open
Kou-JunHao wants to merge 9 commits into
chen08209:devfrom
Kou-JunHao:feature/chain-proxy
Open

feat: add configurable chain proxy support#2296
Kou-JunHao wants to merge 9 commits into
chen08209:devfrom
Kou-JunHao:feature/chain-proxy

Conversation

@Kou-JunHao

Copy link
Copy Markdown

Summary

  • add an opt-in chain proxy group with multiple saved routes
  • support profile nodes, proxy-provider nodes, and reusable SOCKS5/HTTP/HTTPS endpoints
  • route the final MATCH rule through a stable internal selector while preserving the original target as the default
  • validate candidate configurations before persistence and restore prior state if applying fails
  • keep the internal group identity locale-independent while showing localized labels

Verification

  • flutter analyze --no-fatal-infos
  • flutter test --reporter expanded (726 tests)
  • CGO_ENABLED=0 go test .
  • CGO_ENABLED=0 go vet .

Copilot AI lite review requested due to automatic review settings August 10, 2026 15:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (MATCH routing + 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 proxies list 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 thread lib/common/task.dart
Comment on lines +312 to +315
proxyGroups.any(
(item) =>
item.type != GroupType.Relay && item.name == chainProxyGroupName,
);
@chen08209
chen08209 force-pushed the dev branch 3 times, most recently from 8179499 to d966b18 Compare August 15, 2026 11:41
@chen08209
chen08209 force-pushed the dev branch 7 times, most recently from 7748c64 to e17fe6d Compare September 1, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants