mirror of
https://github.com/black-ant/Ant-Browser.git
synced 2026-07-14 18:48:55 +08:00
fix: enable mihomo ipv6 speed tests
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user