From f688eda2c22724c203e73020e1be8adfa1e4351c Mon Sep 17 00:00:00 2001 From: comwrg Date: Sat, 11 Jan 2020 21:02:55 +0800 Subject: [PATCH] Chore: fix typo (#479) --- adapters/outboundgroup/parser.go | 6 +++--- adapters/provider/provider.go | 26 +++++++++++++------------- config/config.go | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/adapters/outboundgroup/parser.go b/adapters/outboundgroup/parser.go index e54755f8..f0c01258 100644 --- a/adapters/outboundgroup/parser.go +++ b/adapters/outboundgroup/parser.go @@ -56,7 +56,7 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy, // if Use not empty, drop health check options if len(groupOption.Use) != 0 { hc := provider.NewHealthCheck(ps, "", 0) - pd, err := provider.NewCompatibleProvier(groupName, ps, hc) + pd, err := provider.NewCompatibleProvider(groupName, ps, hc) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy, // select don't need health check if groupOption.Type == "select" { hc := provider.NewHealthCheck(ps, "", 0) - pd, err := provider.NewCompatibleProvier(groupName, ps, hc) + pd, err := provider.NewCompatibleProvider(groupName, ps, hc) if err != nil { 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)) - pd, err := provider.NewCompatibleProvier(groupName, ps, hc) + pd, err := provider.NewCompatibleProvider(groupName, ps, hc) if err != nil { return nil, err } diff --git a/adapters/provider/provider.go b/adapters/provider/provider.go index 7f60aeda..139ce703 100644 --- a/adapters/provider/provider.go +++ b/adapters/provider/provider.go @@ -249,13 +249,13 @@ func NewProxySetProvider(name string, interval time.Duration, vehicle Vehicle, h } } -type CompatibleProvier struct { +type CompatibleProvider struct { name string healthCheck *HealthCheck proxies []C.Proxy } -func (cp *CompatibleProvier) MarshalJSON() ([]byte, error) { +func (cp *CompatibleProvider) MarshalJSON() ([]byte, error) { return json.Marshal(map[string]interface{}{ "name": cp.Name(), "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 } -func (cp *CompatibleProvier) Reload() error { +func (cp *CompatibleProvider) Reload() error { return nil } -func (cp *CompatibleProvier) Destroy() error { +func (cp *CompatibleProvider) Destroy() error { cp.healthCheck.close() return nil } -func (cp *CompatibleProvier) HealthCheck() { +func (cp *CompatibleProvider) HealthCheck() { cp.healthCheck.check() } -func (cp *CompatibleProvier) Update() error { +func (cp *CompatibleProvider) Update() error { return nil } -func (cp *CompatibleProvier) Initial() error { +func (cp *CompatibleProvider) Initial() error { return nil } -func (cp *CompatibleProvier) VehicleType() VehicleType { +func (cp *CompatibleProvider) VehicleType() VehicleType { return Compatible } -func (cp *CompatibleProvier) Type() ProviderType { +func (cp *CompatibleProvider) Type() ProviderType { return Proxy } -func (cp *CompatibleProvier) Proxies() []C.Proxy { +func (cp *CompatibleProvider) Proxies() []C.Proxy { 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 { 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() } - return &CompatibleProvier{ + return &CompatibleProvider{ name: name, proxies: proxies, healthCheck: hc, diff --git a/config/config.go b/config/config.go index e9068f56..24cd330b 100644 --- a/config/config.go +++ b/config/config.go @@ -314,7 +314,7 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[ proxies[groupName] = outbound.NewProxy(group) } - // initial compatible provier + // initial compatible provider for _, pd := range providersMap { if pd.VehicleType() != provider.Compatible { continue @@ -331,7 +331,7 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[ ps = append(ps, proxies[v]) } hc := provider.NewHealthCheck(ps, "", 0) - pd, _ := provider.NewCompatibleProvier(provider.ReservedName, ps, hc) + pd, _ := provider.NewCompatibleProvider(provider.ReservedName, ps, hc) providersMap[provider.ReservedName] = pd global := outboundgroup.NewSelector("GLOBAL", []provider.ProxyProvider{pd})