Feature: make every provider support health check
This commit is contained in:
@ -55,7 +55,8 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy,
|
||||
|
||||
// if Use not empty, drop health check options
|
||||
if len(groupOption.Use) != 0 {
|
||||
pd, err := provider.NewCompatibleProvier(groupName, ps, nil)
|
||||
hc := provider.NewHealthCheck(ps, "", 0)
|
||||
pd, err := provider.NewCompatibleProvier(groupName, ps, hc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -64,7 +65,8 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy,
|
||||
} else {
|
||||
// select don't need health check
|
||||
if groupOption.Type == "select" {
|
||||
pd, err := provider.NewCompatibleProvier(groupName, ps, nil)
|
||||
hc := provider.NewHealthCheck(ps, "", 0)
|
||||
pd, err := provider.NewCompatibleProvier(groupName, ps, hc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -76,11 +78,8 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy,
|
||||
return nil, errMissHealthCheck
|
||||
}
|
||||
|
||||
healthOption := &provider.HealthCheckOption{
|
||||
URL: groupOption.URL,
|
||||
Interval: uint(groupOption.Interval),
|
||||
}
|
||||
pd, err := provider.NewCompatibleProvier(groupName, ps, healthOption)
|
||||
hc := provider.NewHealthCheck(ps, groupOption.URL, uint(groupOption.Interval))
|
||||
pd, err := provider.NewCompatibleProvier(groupName, ps, hc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user