mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 13:41:23 +08:00
[Fix] skip when country code not found in GeoIP.dat
This commit is contained in:
parent
5b7f46bc97
commit
d9d8507c8f
@ -85,6 +85,9 @@ func parseRule(tp, payload, target string, params []string) (C.Rule, error) {
|
||||
default:
|
||||
parseErr = fmt.Errorf("unsupported rule type %s", tp)
|
||||
}
|
||||
if parseErr != nil {
|
||||
return nil, parseErr
|
||||
}
|
||||
ruleExtra := &C.RuleExtra{
|
||||
Network: RC.FindNetwork(params),
|
||||
SourceIPs: RC.FindSourceIPs(params),
|
||||
|
@ -6,10 +6,12 @@ import (
|
||||
"github.com/Dreamacro/clash/component/trie"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
P "github.com/Dreamacro/clash/constant/provider"
|
||||
"github.com/Dreamacro/clash/log"
|
||||
"gopkg.in/yaml.v2"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -129,7 +131,12 @@ func NewRuleSetProvider(name string, behavior P.RuleType, interval time.Duration
|
||||
return err
|
||||
}
|
||||
|
||||
if rp.behavior == P.Classical {
|
||||
rp.count = len(*(*[]C.Rule)(unsafe.Pointer(&rules)))
|
||||
} else {
|
||||
rp.count = len(rulesRaw)
|
||||
}
|
||||
|
||||
rp.setRules(rules)
|
||||
return nil
|
||||
}
|
||||
@ -201,13 +208,12 @@ func handleClassicalRules(rules []string) (interface{}, error) {
|
||||
var classicalRules []C.Rule
|
||||
for _, rawRule := range rules {
|
||||
ruleType, rule, params := ruleParse(rawRule)
|
||||
if ruleType == "RULE-SET" {
|
||||
return nil, errors.New("error rule type")
|
||||
}
|
||||
|
||||
r, err := parseRule(ruleType, rule, "", params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
//return nil, err
|
||||
log.Warnln("%s", err)
|
||||
continue
|
||||
}
|
||||
|
||||
classicalRules = append(classicalRules, r)
|
||||
|
Loading…
Reference in New Issue
Block a user