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 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
}

View file

@ -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,

View file

@ -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})