Skip to content

feature : multi-profile pooling automatically — pick fastest outbound across all active.#2274

Open
Sifat-mahmud wants to merge 1 commit into
hiddify:mainfrom
Sifat-mahmud:main
Open

feature : multi-profile pooling automatically — pick fastest outbound across all active.#2274
Sifat-mahmud wants to merge 1 commit into
hiddify:mainfrom
Sifat-mahmud:main

Conversation

@Sifat-mahmud

Copy link
Copy Markdown

… profiles, auto-switch on failure

  • ProfileDao: dropped single-active exclusivity in insert/edit/deleteById; added watchActiveProfiles() (plural) and getActiveProfiles().
  • ProfileRepository: added setActive(id, value) and watchActiveProfiles().
  • active_profile_notifier.dart: new ActiveProfiles Riverpod notifier (plural); singular ActiveProfile kept for backward-compat (ChainProfileNotifier, etc.).
  • ProfilesNotifier: added toggleActiveProfile(id, value) for the new per-profile toggle UI; updated deleteProfile to use the plural list.
  • merged_config_builder.dart (NEW): pools every active profile's real outbounds (prefixed ${profileId}::${tag}), strips per-profile selector/urltest/balancer groups, appends a single top-level urltest group tagged 'select'. The core's URLTest machinery auto-picks the lowest-delay outbound across ALL active profiles.
  • ConnectionRepository: connect/reconnect now take List, build the merged config, and pass _merged.json to singbox.start/restart. Added mergedConfigBuilder dependency.
  • ConnectionNotifier: _connectThrottled reads activeProfilesProvider and bails if empty; the auto-reconnect listener now compares SETS of profile ids and only reconnects when the active set changes.
  • Updated all callers of reconnect (connection_button.dart, connection_wrapper.dart, config_option_notifier.dart, profile_notifier.dart) to pass lists.
  • ProfileTile: body-tap now calls toggleActiveProfile(id, !active) — toggles on/off without deactivating others; removed auto-pop-on-success.
  • HomePage: shows a 'N active profiles pooled' badge when >1 are active.
  • ActiveProxyFooter: strips the ${profileId}:: prefix from the displayed tag and shows 'via ' underneath.
  • auto_profile_switch_notifier.dart (NEW): watches the active-proxy stream and deactivates a profile after 3 consecutive url-test rounds where ALL its outbounds are unreachable (delay == 0 or >= 65000). The connection notifier then reconnects with the remaining (healthy) profiles — i.e. the app 'switches to a different profile by itself'.
  • Wired AutoProfileSwitchNotifier into ConnectionWrapper.

NOTE: run 'dart run build_runner build --delete-conflicting-outputs' to
regenerate .g.dart files for the new/changed Riverpod notifiers
(ActiveProfiles, AutoProfileSwitchNotifier, mergedConfigBuilderProvider).

… profiles, auto-switch on failure

  - ProfileDao: dropped single-active exclusivity in insert/edit/deleteById;
    added watchActiveProfiles() (plural) and getActiveProfiles().
  - ProfileRepository: added setActive(id, value) and watchActiveProfiles().
  - active_profile_notifier.dart: new ActiveProfiles Riverpod notifier (plural);
    singular ActiveProfile kept for backward-compat (ChainProfileNotifier, etc.).
  - ProfilesNotifier: added toggleActiveProfile(id, value) for the new
    per-profile toggle UI; updated deleteProfile to use the plural list.
  - merged_config_builder.dart (NEW): pools every active profile's real
    outbounds (prefixed ${profileId}::${tag}), strips per-profile
    selector/urltest/balancer groups, appends a single top-level urltest
    group tagged 'select'. The core's URLTest machinery auto-picks the
    lowest-delay outbound across ALL active profiles.
  - ConnectionRepository: connect/reconnect now take List<ProfileEntity>,
    build the merged config, and pass _merged.json to singbox.start/restart.
    Added mergedConfigBuilder dependency.
  - ConnectionNotifier: _connectThrottled reads activeProfilesProvider and
    bails if empty; the auto-reconnect listener now compares SETS of
    profile ids and only reconnects when the active set changes.
  - Updated all callers of reconnect (connection_button.dart,
    connection_wrapper.dart, config_option_notifier.dart,
    profile_notifier.dart) to pass lists.
  - ProfileTile: body-tap now calls toggleActiveProfile(id, !active) —
    toggles on/off without deactivating others; removed auto-pop-on-success.
  - HomePage: shows a 'N active profiles pooled' badge when >1 are active.
  - ActiveProxyFooter: strips the ${profileId}:: prefix from the displayed
    tag and shows 'via <profile name>' underneath.
  - auto_profile_switch_notifier.dart (NEW): watches the active-proxy stream
    and deactivates a profile after 3 consecutive url-test rounds where ALL
    its outbounds are unreachable (delay == 0 or >= 65000). The connection
    notifier then reconnects with the remaining (healthy) profiles — i.e.
    the app 'switches to a different profile by itself'.
  - Wired AutoProfileSwitchNotifier into ConnectionWrapper.

  NOTE: run 'dart run build_runner build --delete-conflicting-outputs' to
  regenerate .g.dart files for the new/changed Riverpod notifiers
  (ActiveProfiles, AutoProfileSwitchNotifier, mergedConfigBuilderProvider).
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.

2 participants