Fix missing rule_set_ipcidr_match_source item in DNS rules

This commit is contained in:
世界
2024-02-21 14:27:55 +08:00
parent 0843c22e83
commit f6ced68f38
8 changed files with 62 additions and 40 deletions

View File

@@ -219,7 +219,7 @@ func NewDefaultDNSRule(router adapter.Router, logger log.ContextLogger, options
rule.allItems = append(rule.allItems, item)
}
if len(options.RuleSet) > 0 {
item := NewRuleSetItem(router, options.RuleSet, false)
item := NewRuleSetItem(router, options.RuleSet, options.RuleSetIPCIDRMatchSource)
rule.items = append(rule.items, item)
rule.allItems = append(rule.allItems, item)
}
@@ -247,7 +247,7 @@ func (r *DefaultDNSRule) WithAddressLimit() bool {
if !isRuleSet {
continue
}
if ruleSet.ContainsIPCIDRRule() {
if ruleSet.ContainsDestinationIPCIDRRule() {
return true
}
}

View File

@@ -47,7 +47,10 @@ func (r *RuleSetItem) Match(metadata *adapter.InboundContext) bool {
return false
}
func (r *RuleSetItem) ContainsIPCIDRRule() bool {
func (r *RuleSetItem) ContainsDestinationIPCIDRRule() bool {
if r.ipcidrMatchSource {
return false
}
return common.Any(r.setList, func(ruleSet adapter.RuleSet) bool {
return ruleSet.Metadata().ContainsIPCIDRRule
})