Skip to content

fix: keep health check when proxy group is named default - #3165

Open
soffchen wants to merge 1 commit into
MetaCubeX:Alphafrom
soffchen:fix/default-group-health-check
Open

fix: keep health check when proxy group is named default#3165
soffchen wants to merge 1 commit into
MetaCubeX:Alphafrom
soffchen:fix/default-group-health-check

Conversation

@soffchen

Copy link
Copy Markdown

Description

A fallback / url-test / load-balance proxy group named default never runs its periodic health check. Traffic stays on the first node until someone triggers a manual delay test.

This was found on a gateway running Mihomo Meta v1.19.30: a fallback group named default with interval: 30 did not URL-test for hours. After a restart it still selected the first node with empty delay history. GET /group/default/delay immediately marked dead nodes and switched. Renaming the group to proxy made the 30s ticker start on boot.

proxy-providers cannot be named default (ReservedName), but a proxy-group of the same name is allowed. ParseProxyGroup registers that group's compatible provider (with url / interval) as providersMap["default"]. parseProxies then overwrites the map entry with the reserved compatible provider used by GLOBAL (url == "", interval == 0). loadProvider only Initial()s map entries, so the group's health-check goroutine never starts. Untested nodes are treated as alive, so fallback sticks to the first member.

Change

Create the reserved provider for GLOBAL as before. If a user group already claimed providersMap["default"], keep that entry and only attach the reserved provider to GLOBAL. Configs without a group named default are unchanged.

Reproduction

proxies:
  - { name: node-a, type: socks5, server: 127.0.0.1, port: 1080 }
  - { name: node-b, type: socks5, server: 127.0.0.1, port: 1081 }
proxy-groups:
  - name: default
    type: fallback
    url: http://www.gstatic.com/generate_204
    interval: 30
    proxies: [node-a, node-b]

After startup, GET /providers/proxies/default shows an empty testUrl and the reserved all-outbound list, not the group's members. Delay history stays empty until a manual group delay test.

Validation

gofmt -l config/config.go config/utils_test.go
git diff --check
go test ./config/

The reserved compatible provider uses the name "default" for GLOBAL.
proxy-providers named default are rejected, but a proxy-group of the
same name still registers its compatible provider in providersMap.
parseProxies then overwrote that entry with the reserved provider
(empty URL, interval 0). loadProvider only Initial()s map entries, so
fallback/url-test interval never started and the group stayed on the
first node until a manual delay test.

Keep the group's provider in the map and still attach the reserved
provider to GLOBAL.
@wwqgtxx

wwqgtxx commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

This is essentially an implementation oversight; users shouldn't be allowed to define a group named "default".

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