mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-10 03:09:04 +08:00
fix: classical rule-set 更新未清理
This commit is contained in:
parent
2145cebe1f
commit
c3177da2fa
@ -30,20 +30,24 @@ func (c *classicalStrategy) ShouldResolveIP() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *classicalStrategy) OnUpdate(rules []string) {
|
func (c *classicalStrategy) OnUpdate(rules []string) {
|
||||||
|
var classicalRules []C.Rule
|
||||||
|
shouldResolveIP := false
|
||||||
for _, rawRule := range rules {
|
for _, rawRule := range rules {
|
||||||
ruleType, rule, params := ruleParse(rawRule)
|
ruleType, rule, params := ruleParse(rawRule)
|
||||||
r, err := parseRule(ruleType, rule, "", params)
|
r, err := parseRule(ruleType, rule, "", params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnln("parse rule error:[%s]", err.Error())
|
log.Warnln("parse rule error:[%s]", err.Error())
|
||||||
} else {
|
} else {
|
||||||
if !c.shouldResolveIP {
|
if !shouldResolveIP {
|
||||||
c.shouldResolveIP = r.ShouldResolveIP()
|
shouldResolveIP = r.ShouldResolveIP()
|
||||||
}
|
}
|
||||||
|
|
||||||
c.rules = append(c.rules, r)
|
classicalRules = append(classicalRules, r)
|
||||||
c.count++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.rules = classicalRules
|
||||||
|
c.count = len(classicalRules)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClassicalStrategy() *classicalStrategy {
|
func NewClassicalStrategy() *classicalStrategy {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user