diff --git a/config/config.go b/config/config.go index 461db58e..f8d0dfd7 100644 --- a/config/config.go +++ b/config/config.go @@ -493,7 +493,7 @@ func parseRules(cfg *RawConfig, proxies map[string]C.Proxy) ([]C.Rule, map[strin } ruleProviders[name] = &rp - R.SetRuleProvider(&rp) + R.SetRuleProvider(rp) } for _, provider := range ruleProviders { diff --git a/rule/provider.go b/rule/provider.go index 74acddbd..ea409f55 100644 --- a/rule/provider.go +++ b/rule/provider.go @@ -13,7 +13,7 @@ import ( ) var ( - ruleProviders = map[string]*P.RuleProvider{} + ruleProviders = map[string]P.RuleProvider{} ) type ruleSetProvider struct { @@ -38,13 +38,13 @@ type RulePayload struct { Rules []string `yaml:"payload"` } -func RuleProviders() map[string]*P.RuleProvider { +func RuleProviders() map[string]P.RuleProvider { return ruleProviders } -func SetRuleProvider(ruleProvider *P.RuleProvider) { +func SetRuleProvider(ruleProvider P.RuleProvider) { if ruleProvider != nil { - ruleProviders[(*ruleProvider).Name()] = ruleProvider + ruleProviders[(ruleProvider).Name()] = ruleProvider } } diff --git a/rule/rule_set.go b/rule/rule_set.go index 07f18bd0..03e7b2a3 100644 --- a/rule/rule_set.go +++ b/rule/rule_set.go @@ -9,7 +9,7 @@ import ( type RuleSet struct { ruleProviderName string adapter string - ruleProvider *P.RuleProvider + ruleProvider P.RuleProvider ruleExtra *C.RuleExtra } @@ -38,7 +38,7 @@ func (rs *RuleSet) getProviders() P.RuleProvider { rs.ruleProvider = rp } - return *rs.ruleProvider + return rs.ruleProvider } func (rs *RuleSet) RuleExtra() *C.RuleExtra {