Chore: fix typo (#479)

This commit is contained in:
comwrg 2020-01-11 21:02:55 +08:00 committed by Dreamacro
parent 2810533df4
commit f688eda2c2
3 changed files with 18 additions and 18 deletions

View file

@ -56,7 +56,7 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy,
// if Use not empty, drop health check options // if Use not empty, drop health check options
if len(groupOption.Use) != 0 { if len(groupOption.Use) != 0 {
hc := provider.NewHealthCheck(ps, "", 0) hc := provider.NewHealthCheck(ps, "", 0)
pd, err := provider.NewCompatibleProvier(groupName, ps, hc) pd, err := provider.NewCompatibleProvider(groupName, ps, hc)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -66,7 +66,7 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy,
// select don't need health check // select don't need health check
if groupOption.Type == "select" { if groupOption.Type == "select" {
hc := provider.NewHealthCheck(ps, "", 0) hc := provider.NewHealthCheck(ps, "", 0)
pd, err := provider.NewCompatibleProvier(groupName, ps, hc) pd, err := provider.NewCompatibleProvider(groupName, ps, hc)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -79,7 +79,7 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy,
} }
hc := provider.NewHealthCheck(ps, groupOption.URL, uint(groupOption.Interval)) hc := provider.NewHealthCheck(ps, groupOption.URL, uint(groupOption.Interval))
pd, err := provider.NewCompatibleProvier(groupName, ps, hc) pd, err := provider.NewCompatibleProvider(groupName, ps, hc)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -249,13 +249,13 @@ func NewProxySetProvider(name string, interval time.Duration, vehicle Vehicle, h
} }
} }
type CompatibleProvier struct { type CompatibleProvider struct {
name string name string
healthCheck *HealthCheck healthCheck *HealthCheck
proxies []C.Proxy proxies []C.Proxy
} }
func (cp *CompatibleProvier) MarshalJSON() ([]byte, error) { func (cp *CompatibleProvider) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{ return json.Marshal(map[string]interface{}{
"name": cp.Name(), "name": cp.Name(),
"type": cp.Type().String(), "type": cp.Type().String(),
@ -264,44 +264,44 @@ func (cp *CompatibleProvier) MarshalJSON() ([]byte, error) {
}) })
} }
func (cp *CompatibleProvier) Name() string { func (cp *CompatibleProvider) Name() string {
return cp.name return cp.name
} }
func (cp *CompatibleProvier) Reload() error { func (cp *CompatibleProvider) Reload() error {
return nil return nil
} }
func (cp *CompatibleProvier) Destroy() error { func (cp *CompatibleProvider) Destroy() error {
cp.healthCheck.close() cp.healthCheck.close()
return nil return nil
} }
func (cp *CompatibleProvier) HealthCheck() { func (cp *CompatibleProvider) HealthCheck() {
cp.healthCheck.check() cp.healthCheck.check()
} }
func (cp *CompatibleProvier) Update() error { func (cp *CompatibleProvider) Update() error {
return nil return nil
} }
func (cp *CompatibleProvier) Initial() error { func (cp *CompatibleProvider) Initial() error {
return nil return nil
} }
func (cp *CompatibleProvier) VehicleType() VehicleType { func (cp *CompatibleProvider) VehicleType() VehicleType {
return Compatible return Compatible
} }
func (cp *CompatibleProvier) Type() ProviderType { func (cp *CompatibleProvider) Type() ProviderType {
return Proxy return Proxy
} }
func (cp *CompatibleProvier) Proxies() []C.Proxy { func (cp *CompatibleProvider) Proxies() []C.Proxy {
return cp.proxies return cp.proxies
} }
func NewCompatibleProvier(name string, proxies []C.Proxy, hc *HealthCheck) (*CompatibleProvier, error) { func NewCompatibleProvider(name string, proxies []C.Proxy, hc *HealthCheck) (*CompatibleProvider, error) {
if len(proxies) == 0 { if len(proxies) == 0 {
return nil, errors.New("Provider need one proxy at least") return nil, errors.New("Provider need one proxy at least")
} }
@ -310,7 +310,7 @@ func NewCompatibleProvier(name string, proxies []C.Proxy, hc *HealthCheck) (*Com
go hc.process() go hc.process()
} }
return &CompatibleProvier{ return &CompatibleProvider{
name: name, name: name,
proxies: proxies, proxies: proxies,
healthCheck: hc, healthCheck: hc,

View file

@ -314,7 +314,7 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[
proxies[groupName] = outbound.NewProxy(group) proxies[groupName] = outbound.NewProxy(group)
} }
// initial compatible provier // initial compatible provider
for _, pd := range providersMap { for _, pd := range providersMap {
if pd.VehicleType() != provider.Compatible { if pd.VehicleType() != provider.Compatible {
continue continue
@ -331,7 +331,7 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[
ps = append(ps, proxies[v]) ps = append(ps, proxies[v])
} }
hc := provider.NewHealthCheck(ps, "", 0) hc := provider.NewHealthCheck(ps, "", 0)
pd, _ := provider.NewCompatibleProvier(provider.ReservedName, ps, hc) pd, _ := provider.NewCompatibleProvider(provider.ReservedName, ps, hc)
providersMap[provider.ReservedName] = pd providersMap[provider.ReservedName] = pd
global := outboundgroup.NewSelector("GLOBAL", []provider.ProxyProvider{pd}) global := outboundgroup.NewSelector("GLOBAL", []provider.ProxyProvider{pd})