chore: code cleanup

This commit is contained in:
wwqgtxx
2024-12-19 09:29:17 +08:00
parent bb803249fa
commit 5a9ad0ed3c
5 changed files with 18 additions and 21 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/metacubex/mihomo/component/resource"
C "github.com/metacubex/mihomo/constant"
P "github.com/metacubex/mihomo/constant/provider"
"github.com/metacubex/mihomo/rules/common"
)
var (
@@ -27,9 +28,7 @@ type ruleProviderSchema struct {
Payload []string `provider:"payload,omitempty"`
}
type parseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)
func ParseRuleProvider(name string, mapping map[string]any, parse parseRuleFunc) (P.RuleProvider, error) {
func ParseRuleProvider(name string, mapping map[string]any, parse common.ParseRuleFunc) (P.RuleProvider, error) {
schema := &ruleProviderSchema{}
decoder := structure.NewDecoder(structure.Option{TagName: "provider", WeaklyTypedInput: true})
if err := decoder.Decode(mapping, schema); err != nil {