Fix nested rule-set match cache isolation

This commit is contained in:
世界
2026-03-23 12:26:19 +08:00
parent fbb51d2cae
commit 8bf01b7add
4 changed files with 15 additions and 5 deletions

View File

@@ -41,10 +41,12 @@ func (r *RuleSetItem) Start() error {
}
func (r *RuleSetItem) Match(metadata *adapter.InboundContext) bool {
metadata.IPCIDRMatchSource = r.ipCidrMatchSource
metadata.IPCIDRAcceptEmpty = r.ipCidrAcceptEmpty
for _, ruleSet := range r.setList {
if ruleSet.Match(metadata) {
nestedMetadata := *metadata
nestedMetadata.ResetRuleMatchCache()
nestedMetadata.IPCIDRMatchSource = r.ipCidrMatchSource
nestedMetadata.IPCIDRAcceptEmpty = r.ipCidrAcceptEmpty
if ruleSet.Match(&nestedMetadata) {
return true
}
}