From 5807e076085a96e328926554fe26c775400bf53c Mon Sep 17 00:00:00 2001 From: SukkaW Date: Fri, 17 Oct 2025 20:53:31 +0800 Subject: [PATCH] Disable Wildcard Dedupe --- Build/lib/rules/base.ts | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Build/lib/rules/base.ts b/Build/lib/rules/base.ts index dbfbf623..11e3664e 100644 --- a/Build/lib/rules/base.ts +++ b/Build/lib/rules/base.ts @@ -21,7 +21,7 @@ export class FileOutput { protected dataSource = new Set(); public domainTrie = new HostnameSmolTrie(null); - public wildcardTrie: HostnameSmolTrie = new HostnameSmolTrie(null); + public wildcardSet = new Set(); protected domainKeywords = new Set(); @@ -51,7 +51,6 @@ export class FileOutput { whitelistDomain = (domain: string) => { this.domainTrie.whitelist(domain); - this.wildcardTrie.whitelist(domain); return this; }; @@ -150,7 +149,7 @@ export class FileOutput { bulkAddDomainWildcard(domains: string[]) { for (let i = 0, len = domains.length; i < len; i++) { - this.wildcardTrie.add(domains[i]); + this.wildcardSet.add(domains[i]); } return this; } @@ -216,7 +215,7 @@ export class FileOutput { this.addDomainKeyword(value); break; case 'DOMAIN-WILDCARD': - this.wildcardTrie.add(value); + this.wildcardSet.add(value); break; case 'USER-AGENT': this.userAgent.add(value); @@ -418,8 +417,6 @@ export class FileOutput { return; } - this.wildcardTrie.whitelist(domain, includeAllSubdomain); - for (let i = 0; i < strategiesLen; i++) { const strategy = this.strategies[i]; if (includeAllSubdomain) { @@ -445,16 +442,14 @@ export class FileOutput { } } - this.wildcardTrie.dumpWithoutDot((wildcard) => { - if (kwfilter(wildcard)) { - return; - } - - for (let i = 0; i < strategiesLen; i++) { - const strategy = this.strategies[i]; - strategy.writeDomainWildcard(wildcard); - } - }, true); + if (this.wildcardSet.size) { + this.wildcardSet.forEach((wildcard) => { + for (let i = 0; i < strategiesLen; i++) { + const strategy = this.strategies[i]; + strategy.writeDomainWildcard(wildcard); + } + }); + } const sourceIpOrCidr = Array.from(this.sourceIpOrCidr);