[test] rule providers

This commit is contained in:
maze.y2b@gmail.com
2021-11-25 23:14:31 +08:00
parent cad18b7529
commit 078389f4f6
5 changed files with 380 additions and 0 deletions

View File

@ -1,6 +1,9 @@
package provider
import "C"
import (
"errors"
"github.com/Dreamacro/clash/component/trie"
"github.com/Dreamacro/clash/constant"
)
@ -103,3 +106,26 @@ type RuleProvider interface {
ShouldResolveIP() bool
AsRule(adaptor string) constant.Rule
}
var (
parse = func(ruleType, rule string, params []string) (C.Rule, error) {
return nil, errors.New("unimplemented function")
}
ruleProviders = map[string]*RuleProvider{}
)
func RuleProviders() map[string]*RuleProvider {
return ruleProviders
}
type ruleSetProvider struct {
count int
DomainRules *trie.DomainTrie
IPCIDRRules *trie.IpCidrTrie
ClassicalRules []C.Rule
}
type RuleSetProvider struct {
*ruleSetProvider
}