fix: health check available for 'selector' if configured
This commit is contained in:
parent
d85d8ac13f
commit
7d222b1b71
2 changed files with 4 additions and 10 deletions
|
@ -92,9 +92,6 @@ func ParseProxyGroup(config map[string]any, proxyMap map[string]C.Proxy, provide
|
|||
return nil, fmt.Errorf("%s: %w", groupName, errDuplicateProvider)
|
||||
}
|
||||
|
||||
var url string
|
||||
var interval uint
|
||||
|
||||
// select don't need health check
|
||||
if groupOption.Type != "select" && groupOption.Type != "relay" {
|
||||
if groupOption.URL == "" {
|
||||
|
@ -104,12 +101,10 @@ func ParseProxyGroup(config map[string]any, proxyMap map[string]C.Proxy, provide
|
|||
if groupOption.Interval == 0 {
|
||||
groupOption.Interval = 300
|
||||
}
|
||||
|
||||
url = groupOption.URL
|
||||
interval = uint(groupOption.Interval)
|
||||
}
|
||||
|
||||
hc := provider.NewHealthCheck(ps, url, interval, true, expectedStatus)
|
||||
hc := provider.NewHealthCheck(ps, groupOption.URL, uint(groupOption.Interval), true, expectedStatus)
|
||||
|
||||
pd, err := provider.NewCompatibleProvider(groupName, ps, hc)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", groupName, err)
|
||||
|
|
|
@ -10,8 +10,6 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/metacubex/mihomo/ntp"
|
||||
|
||||
"github.com/metacubex/mihomo/adapter"
|
||||
"github.com/metacubex/mihomo/adapter/inbound"
|
||||
"github.com/metacubex/mihomo/adapter/outboundgroup"
|
||||
|
@ -35,6 +33,7 @@ import (
|
|||
"github.com/metacubex/mihomo/listener/inner"
|
||||
"github.com/metacubex/mihomo/listener/tproxy"
|
||||
"github.com/metacubex/mihomo/log"
|
||||
"github.com/metacubex/mihomo/ntp"
|
||||
"github.com/metacubex/mihomo/tunnel"
|
||||
)
|
||||
|
||||
|
@ -310,7 +309,7 @@ func loadProxyProvider(proxyProviders map[string]provider.ProxyProvider) {
|
|||
go func() {
|
||||
defer func() { <-ch; wg.Done() }()
|
||||
loadProvider(proxyProvider)
|
||||
if proxyProvider.VehicleType()==provider.Compatible{
|
||||
if proxyProvider.VehicleType() == provider.Compatible {
|
||||
go proxyProvider.HealthCheck()
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Reference in a new issue