fix: enable mihomo ipv6 speed tests

This commit is contained in:
ant-black
2026-06-10 23:18:30 +08:00
parent 16b7c57137
commit eec33b305a
2 changed files with 19 additions and 0 deletions
+6
View File
@@ -5,6 +5,7 @@ import (
"time"
"github.com/metacubex/mihomo/adapter"
"github.com/metacubex/mihomo/component/resolver"
"ant-chrome/backend/internal/config"
"ant-chrome/backend/internal/logger"
@@ -62,6 +63,7 @@ func SpeedTest(
if testURL == "" {
return TestResult{ProxyId: proxyId, Ok: false, Error: "测速目标 URL 为空"}
}
enableMihomoIPv6()
resolvedSrc := src
if IsChainSocks5Proxy(src) {
@@ -104,3 +106,7 @@ func SpeedTest(
adapter.UnifiedDelay.Store(true)
return unifiedDelayTest(proxyId, proxyInstance, testURL, cfg.Timeout)
}
func enableMihomoIPv6() {
resolver.DisableIPv6 = false
}
+13
View File
@@ -4,6 +4,8 @@ import (
"encoding/base64"
"strings"
"testing"
"github.com/metacubex/mihomo/component/resolver"
)
func TestProxyConfigToMappingStandardProxy(t *testing.T) {
@@ -31,6 +33,17 @@ func TestProxyConfigToMappingStandardProxy(t *testing.T) {
}
}
func TestEnableMihomoIPv6(t *testing.T) {
resolver.DisableIPv6 = true
t.Cleanup(func() { resolver.DisableIPv6 = true })
enableMihomoIPv6()
if resolver.DisableIPv6 {
t.Fatal("expected mihomo IPv6 resolver to be enabled")
}
}
func TestProxyConfigToMappingEscapedCredentials(t *testing.T) {
t.Parallel()