瀏覽代碼

Feat: enable merge for IP rules

SukkaW 1 年之前
父節點
當前提交
7acda2b5a4
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Build/lib/rules/ip.ts

+ 3 - 1
Build/lib/rules/ip.ts

@@ -3,6 +3,8 @@ import { appendArrayFromSet } from '../misc';
 import type { SingboxSourceFormat } from '../singbox';
 import { RuleOutput } from './base';
 
+import { merge } from 'fast-cidr-tools';
+
 export class IPListOutput extends RuleOutput {
   protected type = 'ip' as const;
 
@@ -13,7 +15,7 @@ export class IPListOutput extends RuleOutput {
   private $merged: string[] | null = null;
   get merged() {
     if (!this.$merged) {
-      this.$merged = appendArrayFromSet(appendArrayFromSet([], this.ipcidr), this.ipcidr6);
+      this.$merged = merge(appendArrayFromSet([], [this.ipcidr, this.ipcidr6]));
     }
     return this.$merged;
   }