Update Reject & Domestic Rules

This commit is contained in:
SukkaW
2024-10-25 08:05:57 +08:00
parent f3683fa34a
commit 9f26d11fef
6 changed files with 38 additions and 5 deletions

View File

@@ -241,8 +241,6 @@ export abstract class RuleOutput<TPreprocessed = unknown> {
}
private guardPendingPromise() {
console.log('Pending promise:', this.pendingPromise);
// reverse invariant
if (this.pendingPromise !== null) {
console.trace('Pending promise:', this.pendingPromise);

View File

@@ -128,6 +128,27 @@ export class DomainsetOutput extends RuleOutput<Preprocessed> {
results.push(`/${keyword}/`);
}
for (const ipGroup of [this.ipcidr, this.ipcidrNoResolve]) {
for (const ipcidr of ipGroup) {
if (ipcidr.endsWith('/32')) {
results.push(`||${ipcidr.slice(0, -3)}`);
} else if (ipcidr.endsWith('.0/24')) {
results.push(`||${ipcidr.slice(0, -6)}.*`);
} else {
results.push(`||${ipcidr}^`);
}
}
}
for (const ipGroup of [this.ipcidr6, this.ipcidr6NoResolve]) {
for (const ipcidr of ipGroup) {
if (ipcidr.endsWith('/128')) {
results.push(`||${ipcidr.slice(0, -4)}`);
} else {
results.push(`||${ipcidr}`);
}
}
}
return results;
}
}