mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Replace built-in utility with foxts
This commit is contained in:
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|||||||
import { task } from './trace';
|
import { task } from './trace';
|
||||||
import { compareAndWriteFile } from './lib/create-file';
|
import { compareAndWriteFile } from './lib/create-file';
|
||||||
import { getHostname } from 'tldts-experimental';
|
import { getHostname } from 'tldts-experimental';
|
||||||
import { isTruthy } from './lib/misc';
|
import { isTruthy } from 'foxts/guard';
|
||||||
import { OUTPUT_MODULES_DIR } from './constants/dir';
|
import { OUTPUT_MODULES_DIR } from './constants/dir';
|
||||||
|
|
||||||
function escapeRegExp(string = '') {
|
function escapeRegExp(string = '') {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { getChnCidrPromise } from './build-chn-cidr';
|
|||||||
import { getTelegramCIDRPromise } from './build-telegram-cidr';
|
import { getTelegramCIDRPromise } from './build-telegram-cidr';
|
||||||
import { compareAndWriteFile, RulesetOutput } from './lib/create-file';
|
import { compareAndWriteFile, RulesetOutput } from './lib/create-file';
|
||||||
import { getMicrosoftCdnRulesetPromise } from './build-microsoft-cdn';
|
import { getMicrosoftCdnRulesetPromise } from './build-microsoft-cdn';
|
||||||
import { isTruthy } from './lib/misc';
|
import { isTruthy } from 'foxts/guard';
|
||||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||||
import { OUTPUT_INTERNAL_DIR, OUTPUT_SURGE_DIR, SOURCE_DIR } from './constants/dir';
|
import { OUTPUT_INTERNAL_DIR, OUTPUT_SURGE_DIR, SOURCE_DIR } from './constants/dir';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import os from 'node:os';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { mkdirSync } from 'node:fs';
|
import { mkdirSync } from 'node:fs';
|
||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
import { fastStringArrayJoin, identity, mergeHeaders } from './misc';
|
import { mergeHeaders } from 'foxts/merge-headers';
|
||||||
|
import { headersToObject } from 'foxts/headers-to-object';
|
||||||
|
import { identity } from 'foxts/identity';
|
||||||
|
import { fastStringArrayJoin } from 'foxts/fast-string-array-join';
|
||||||
import { performance } from 'node:perf_hooks';
|
import { performance } from 'node:perf_hooks';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { stringHash } from './string-hash';
|
import { stringHash } from './string-hash';
|
||||||
@@ -250,7 +253,7 @@ export class Cache<S = string> {
|
|||||||
{
|
{
|
||||||
...defaultRequestInit,
|
...defaultRequestInit,
|
||||||
headers: (typeof etag === 'string' && etag.length > 0)
|
headers: (typeof etag === 'string' && etag.length > 0)
|
||||||
? mergeHeaders<Record<string, string>>(defaultRequestInit.headers, { 'If-None-Match': etag })
|
? headersToObject(mergeHeaders(defaultRequestInit.headers, { 'If-None-Match': etag }))
|
||||||
: defaultRequestInit.headers
|
: defaultRequestInit.headers
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -308,7 +311,7 @@ export class Cache<S = string> {
|
|||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
...defaultRequestInit,
|
...defaultRequestInit,
|
||||||
headers: (typeof etag === 'string' && etag.length > 0 && typeof previouslyCached === 'string' && previouslyCached.length > 1)
|
headers: (typeof etag === 'string' && etag.length > 0 && typeof previouslyCached === 'string' && previouslyCached.length > 1)
|
||||||
? mergeHeaders<Record<string, string>>(defaultRequestInit.headers, { 'If-None-Match': etag })
|
? headersToObject(mergeHeaders(defaultRequestInit.headers, { 'If-None-Match': etag }))
|
||||||
: defaultRequestInit.headers
|
: defaultRequestInit.headers
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import { isCI } from 'ci-info';
|
|||||||
import { xxhash64 } from 'hash-wasm';
|
import { xxhash64 } from 'hash-wasm';
|
||||||
|
|
||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
import { fastStringArrayJoin, identity } from './misc';
|
import { fastStringArrayJoin } from 'foxts/fast-string-array-join';
|
||||||
|
import { identity } from 'foxts/identity';
|
||||||
|
|
||||||
const fsMemoCache = new Cache({ cachePath: path.resolve(__dirname, '../../.cache'), tableName: 'fs_memo_cache' });
|
const fsMemoCache = new Cache({ cachePath: path.resolve(__dirname, '../../.cache'), tableName: 'fs_memo_cache' });
|
||||||
|
|
||||||
|
|||||||
@@ -2,24 +2,6 @@ import path, { dirname } from 'node:path';
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import fsp from 'node:fs/promises';
|
import fsp from 'node:fs/promises';
|
||||||
import { OUTPUT_CLASH_DIR, OUTPUT_SINGBOX_DIR, OUTPUT_SURGE_DIR } from '../constants/dir';
|
import { OUTPUT_CLASH_DIR, OUTPUT_SINGBOX_DIR, OUTPUT_SURGE_DIR } from '../constants/dir';
|
||||||
import type { HeadersInit } from 'undici';
|
|
||||||
|
|
||||||
export const isTruthy = <T>(i: T | 0 | '' | false | null | undefined): i is T => !!i;
|
|
||||||
|
|
||||||
export function fastStringArrayJoin(arr: string[], sep: string) {
|
|
||||||
const len = arr.length;
|
|
||||||
if (len === 0) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = arr[0];
|
|
||||||
|
|
||||||
for (let i = 1; i < len; i++) {
|
|
||||||
result += sep;
|
|
||||||
result += arr[i];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function fastStringCompare(a: string, b: string) {
|
export function fastStringCompare(a: string, b: string) {
|
||||||
const lenA = a.length;
|
const lenA = a.length;
|
||||||
@@ -86,22 +68,6 @@ export function domainWildCardToRegex(domain: string) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const identity = <T, R = T>(x: T): R => x as any;
|
|
||||||
|
|
||||||
export function appendArrayFromSet<T>(dest: T[], source: Set<T> | Array<Set<T>>, transformer: (item: T) => T = identity) {
|
|
||||||
const casted = Array.isArray(source) ? source : [source];
|
|
||||||
for (let i = 0, len = casted.length; i < len; i++) {
|
|
||||||
const iterator = casted[i].values();
|
|
||||||
let step: IteratorResult<T, undefined>;
|
|
||||||
|
|
||||||
while ((step = iterator.next(), !step.done)) {
|
|
||||||
dest.push(transformer(step.value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function output(id: string, type: 'non_ip' | 'ip' | 'domainset') {
|
export function output(id: string, type: 'non_ip' | 'ip' | 'domainset') {
|
||||||
return [
|
return [
|
||||||
path.join(OUTPUT_SURGE_DIR, type, id + '.conf'),
|
path.join(OUTPUT_SURGE_DIR, type, id + '.conf'),
|
||||||
@@ -122,30 +88,3 @@ export function withBannerArray(title: string, description: string[] | readonly
|
|||||||
'################## EOF ##################'
|
'################## EOF ##################'
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function mergeHeaders<T extends RequestInit['headers'] | HeadersInit>(headersA: T | undefined, headersB: T | undefined): T {
|
|
||||||
if (headersA == null) {
|
|
||||||
return headersB!;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(headersB)) {
|
|
||||||
throw new TypeError('Array headers is not supported');
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = new Headers(headersA as any);
|
|
||||||
|
|
||||||
if (headersB instanceof Headers) {
|
|
||||||
headersB.forEach((value, key) => {
|
|
||||||
result.set(key, value);
|
|
||||||
});
|
|
||||||
return result as T;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const key in headersB) {
|
|
||||||
if (Object.hasOwn(headersB, key)) {
|
|
||||||
result.set(key, (headersB as Record<string, any>)[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result as T;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { deserializeArray, fsFetchCache, serializeArray, getFileContentHash } fr
|
|||||||
import type { Span } from '../trace';
|
import type { Span } from '../trace';
|
||||||
import createKeywordFilter from './aho-corasick';
|
import createKeywordFilter from './aho-corasick';
|
||||||
import { looseTldtsOpt } from '../constants/loose-tldts-opt';
|
import { looseTldtsOpt } from '../constants/loose-tldts-opt';
|
||||||
import { identity } from './misc';
|
import { identity } from 'foxts/identity';
|
||||||
import { DEBUG_DOMAIN_TO_FIND } from '../constants/reject-data-source';
|
import { DEBUG_DOMAIN_TO_FIND } from '../constants/reject-data-source';
|
||||||
|
|
||||||
let foundDebugDomain = false;
|
let foundDebugDomain = false;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { withBannerArray } from '../misc';
|
|||||||
import { invariant } from 'foxact/invariant';
|
import { invariant } from 'foxact/invariant';
|
||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { fastStringArrayJoin, writeFile } from '../misc';
|
import { writeFile } from '../misc';
|
||||||
|
import { fastStringArrayJoin } from 'foxts/fast-string-array-join';
|
||||||
import { readFileByLine } from '../fetch-text-by-line';
|
import { readFileByLine } from '../fetch-text-by-line';
|
||||||
import { asyncWriteToStream } from '../async-write-to-stream';
|
import { asyncWriteToStream } from '../async-write-to-stream';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Span } from '../../trace';
|
import type { Span } from '../../trace';
|
||||||
import { appendArrayInPlace } from '../append-array-in-place';
|
import { appendArrayInPlace } from '../append-array-in-place';
|
||||||
import { appendArrayFromSet } from '../misc';
|
import { appendSetElementsToArray } from 'foxts/append-set-elements-to-array';
|
||||||
import type { SingboxSourceFormat } from '../singbox';
|
import type { SingboxSourceFormat } from '../singbox';
|
||||||
import { RuleOutput } from './base';
|
import { RuleOutput } from './base';
|
||||||
|
|
||||||
@@ -26,8 +26,8 @@ export class IPListOutput extends RuleOutput<Preprocessed> {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(results, this.ipcidr6NoResolve);
|
appendSetElementsToArray(results, this.ipcidr6NoResolve);
|
||||||
appendArrayFromSet(results, this.ipcidr6);
|
appendSetElementsToArray(results, this.ipcidr6);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@@ -42,12 +42,12 @@ export class IPListOutput extends RuleOutput<Preprocessed> {
|
|||||||
results,
|
results,
|
||||||
merge(Array.from(this.ipcidrNoResolve)).map(i => `IP-CIDR,${i},no-resolve`, true)
|
merge(Array.from(this.ipcidrNoResolve)).map(i => `IP-CIDR,${i},no-resolve`, true)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(results, this.ipcidr6NoResolve, i => `IP-CIDR6,${i},no-resolve`);
|
appendSetElementsToArray(results, this.ipcidr6NoResolve, i => `IP-CIDR6,${i},no-resolve`);
|
||||||
appendArrayInPlace(
|
appendArrayInPlace(
|
||||||
results,
|
results,
|
||||||
merge(Array.from(this.ipcidr)).map(i => `IP-CIDR,${i}`, true)
|
merge(Array.from(this.ipcidr)).map(i => `IP-CIDR,${i}`, true)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(results, this.ipcidr6, i => `IP-CIDR6,${i}`);
|
appendSetElementsToArray(results, this.ipcidr6, i => `IP-CIDR6,${i}`);
|
||||||
|
|
||||||
this.$surge = results;
|
this.$surge = results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { merge } from 'fast-cidr-tools';
|
|||||||
import type { Span } from '../../trace';
|
import type { Span } from '../../trace';
|
||||||
import createKeywordFilter from '../aho-corasick';
|
import createKeywordFilter from '../aho-corasick';
|
||||||
import { appendArrayInPlace } from '../append-array-in-place';
|
import { appendArrayInPlace } from '../append-array-in-place';
|
||||||
import { appendArrayFromSet } from '../misc';
|
import { appendSetElementsToArray } from 'foxts/append-set-elements-to-array';
|
||||||
import type { SingboxSourceFormat } from '../singbox';
|
import type { SingboxSourceFormat } from '../singbox';
|
||||||
import { RuleOutput } from './base';
|
import { RuleOutput } from './base';
|
||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
@@ -43,37 +43,37 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
|
|||||||
const results: string[] = ['DOMAIN,this_ruleset_is_made_by_sukkaw.ruleset.skk.moe'];
|
const results: string[] = ['DOMAIN,this_ruleset_is_made_by_sukkaw.ruleset.skk.moe'];
|
||||||
appendArrayInPlace(results, this.$preprocessed[2]);
|
appendArrayInPlace(results, this.$preprocessed[2]);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.domainKeywords, i => `DOMAIN-KEYWORD,${i}`);
|
appendSetElementsToArray(results, this.domainKeywords, i => `DOMAIN-KEYWORD,${i}`);
|
||||||
appendArrayFromSet(results, this.domainWildcard, i => `DOMAIN-WILDCARD,${i}`);
|
appendSetElementsToArray(results, this.domainWildcard, i => `DOMAIN-WILDCARD,${i}`);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.userAgent, i => `USER-AGENT,${i}`);
|
appendSetElementsToArray(results, this.userAgent, i => `USER-AGENT,${i}`);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.processName, i => `PROCESS-NAME,${i}`);
|
appendSetElementsToArray(results, this.processName, i => `PROCESS-NAME,${i}`);
|
||||||
appendArrayFromSet(results, this.processPath, i => `PROCESS-NAME,${i}`);
|
appendSetElementsToArray(results, this.processPath, i => `PROCESS-NAME,${i}`);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.sourceIpOrCidr, i => `SRC-IP,${i}`);
|
appendSetElementsToArray(results, this.sourceIpOrCidr, i => `SRC-IP,${i}`);
|
||||||
appendArrayFromSet(results, this.sourcePort, i => `SRC-PORT,${i}`);
|
appendSetElementsToArray(results, this.sourcePort, i => `SRC-PORT,${i}`);
|
||||||
appendArrayFromSet(results, this.destPort, i => `DEST-PORT,${i}`);
|
appendSetElementsToArray(results, this.destPort, i => `DEST-PORT,${i}`);
|
||||||
|
|
||||||
appendArrayInPlace(results, this.otherRules);
|
appendArrayInPlace(results, this.otherRules);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.urlRegex, i => `URL-REGEX,${i}`);
|
appendSetElementsToArray(results, this.urlRegex, i => `URL-REGEX,${i}`);
|
||||||
|
|
||||||
appendArrayInPlace(
|
appendArrayInPlace(
|
||||||
results,
|
results,
|
||||||
merge(Array.from(this.ipcidrNoResolve)).map(i => `IP-CIDR,${i},no-resolve`, true)
|
merge(Array.from(this.ipcidrNoResolve)).map(i => `IP-CIDR,${i},no-resolve`, true)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(results, this.ipcidr6NoResolve, i => `IP-CIDR6,${i},no-resolve`);
|
appendSetElementsToArray(results, this.ipcidr6NoResolve, i => `IP-CIDR6,${i},no-resolve`);
|
||||||
appendArrayFromSet(results, this.ipasnNoResolve, i => `IP-ASN,${i},no-resolve`);
|
appendSetElementsToArray(results, this.ipasnNoResolve, i => `IP-ASN,${i},no-resolve`);
|
||||||
appendArrayFromSet(results, this.groipNoResolve, i => `GEOIP,${i},no-resolve`);
|
appendSetElementsToArray(results, this.groipNoResolve, i => `GEOIP,${i},no-resolve`);
|
||||||
|
|
||||||
appendArrayInPlace(
|
appendArrayInPlace(
|
||||||
results,
|
results,
|
||||||
merge(Array.from(this.ipcidr)).map(i => `IP-CIDR,${i}`, true)
|
merge(Array.from(this.ipcidr)).map(i => `IP-CIDR,${i}`, true)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(results, this.ipcidr6, i => `IP-CIDR6,${i}`);
|
appendSetElementsToArray(results, this.ipcidr6, i => `IP-CIDR6,${i}`);
|
||||||
appendArrayFromSet(results, this.ipasn, i => `IP-ASN,${i}`);
|
appendSetElementsToArray(results, this.ipasn, i => `IP-ASN,${i}`);
|
||||||
appendArrayFromSet(results, this.geoip, i => `GEOIP,${i}`);
|
appendSetElementsToArray(results, this.geoip, i => `GEOIP,${i}`);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@@ -83,13 +83,13 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
|
|||||||
|
|
||||||
appendArrayInPlace(results, this.$preprocessed[2]);
|
appendArrayInPlace(results, this.$preprocessed[2]);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.domainKeywords, i => `DOMAIN-KEYWORD,${i}`);
|
appendSetElementsToArray(results, this.domainKeywords, i => `DOMAIN-KEYWORD,${i}`);
|
||||||
appendArrayFromSet(results, this.domainWildcard, i => `DOMAIN-REGEX,${RuleOutput.domainWildCardToRegex(i)}`);
|
appendSetElementsToArray(results, this.domainWildcard, i => `DOMAIN-REGEX,${RuleOutput.domainWildCardToRegex(i)}`);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.processName, i => `PROCESS-NAME,${i}`);
|
appendSetElementsToArray(results, this.processName, i => `PROCESS-NAME,${i}`);
|
||||||
appendArrayFromSet(results, this.processPath, i => `PROCESS-PATH,${i}`);
|
appendSetElementsToArray(results, this.processPath, i => `PROCESS-PATH,${i}`);
|
||||||
|
|
||||||
appendArrayFromSet(results, this.sourceIpOrCidr, value => {
|
appendSetElementsToArray(results, this.sourceIpOrCidr, value => {
|
||||||
if (value.includes('/')) {
|
if (value.includes('/')) {
|
||||||
return `SRC-IP-CIDR,${value}`;
|
return `SRC-IP-CIDR,${value}`;
|
||||||
}
|
}
|
||||||
@@ -101,8 +101,8 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
|
|||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
});
|
});
|
||||||
appendArrayFromSet(results, this.sourcePort, i => `SRC-PORT,${i}`);
|
appendSetElementsToArray(results, this.sourcePort, i => `SRC-PORT,${i}`);
|
||||||
appendArrayFromSet(results, this.destPort, i => `DST-PORT,${i}`);
|
appendSetElementsToArray(results, this.destPort, i => `DST-PORT,${i}`);
|
||||||
|
|
||||||
// appendArrayInPlace(results, this.otherRules);
|
// appendArrayInPlace(results, this.otherRules);
|
||||||
|
|
||||||
@@ -110,17 +110,17 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
|
|||||||
results,
|
results,
|
||||||
merge(Array.from(this.ipcidrNoResolve)).map(i => `IP-CIDR,${i},no-resolve`, true)
|
merge(Array.from(this.ipcidrNoResolve)).map(i => `IP-CIDR,${i},no-resolve`, true)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(results, this.ipcidr6NoResolve, i => `IP-CIDR6,${i},no-resolve`);
|
appendSetElementsToArray(results, this.ipcidr6NoResolve, i => `IP-CIDR6,${i},no-resolve`);
|
||||||
appendArrayFromSet(results, this.ipasnNoResolve, i => `IP-ASN,${i},no-resolve`);
|
appendSetElementsToArray(results, this.ipasnNoResolve, i => `IP-ASN,${i},no-resolve`);
|
||||||
appendArrayFromSet(results, this.groipNoResolve, i => `GEOIP,${i},no-resolve`);
|
appendSetElementsToArray(results, this.groipNoResolve, i => `GEOIP,${i},no-resolve`);
|
||||||
|
|
||||||
appendArrayInPlace(
|
appendArrayInPlace(
|
||||||
results,
|
results,
|
||||||
merge(Array.from(this.ipcidr)).map(i => `IP-CIDR,${i}`, true)
|
merge(Array.from(this.ipcidr)).map(i => `IP-CIDR,${i}`, true)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(results, this.ipcidr6, i => `IP-CIDR6,${i}`);
|
appendSetElementsToArray(results, this.ipcidr6, i => `IP-CIDR6,${i}`);
|
||||||
appendArrayFromSet(results, this.ipasn, i => `IP-ASN,${i}`);
|
appendSetElementsToArray(results, this.ipasn, i => `IP-ASN,${i}`);
|
||||||
appendArrayFromSet(results, this.geoip, i => `GEOIP,${i}`);
|
appendSetElementsToArray(results, this.geoip, i => `GEOIP,${i}`);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@@ -134,8 +134,8 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
appendArrayFromSet(ip_cidr, this.ipcidr6NoResolve);
|
appendSetElementsToArray(ip_cidr, this.ipcidr6NoResolve);
|
||||||
appendArrayFromSet(ip_cidr, this.ipcidr6);
|
appendSetElementsToArray(ip_cidr, this.ipcidr6);
|
||||||
|
|
||||||
const singbox: SingboxSourceFormat = {
|
const singbox: SingboxSourceFormat = {
|
||||||
version: 2,
|
version: 2,
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
* Hostbane-Optimized Trie based on Mnemonist Trie
|
* Hostbane-Optimized Trie based on Mnemonist Trie
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { fastStringArrayJoin, fastStringCompare } from './misc';
|
import { fastStringCompare } from './misc';
|
||||||
import util from 'node:util';
|
import util from 'node:util';
|
||||||
import { noop } from 'foxact/noop';
|
import { noop } from 'foxact/noop';
|
||||||
|
import { fastStringArrayJoin } from 'foxts/fast-string-array-join';
|
||||||
import FIFO from './fifo';
|
import FIFO from './fifo';
|
||||||
|
|
||||||
type TrieNode<Meta = any> = [
|
type TrieNode<Meta = any> = [
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
"fast-cidr-tools": "^0.3.1",
|
"fast-cidr-tools": "^0.3.1",
|
||||||
"fdir": "^6.4.2",
|
"fdir": "^6.4.2",
|
||||||
"foxact": "^0.2.42",
|
"foxact": "^0.2.42",
|
||||||
|
"foxts": "1.0.4",
|
||||||
"hash-wasm": "^4.12.0",
|
"hash-wasm": "^4.12.0",
|
||||||
"json-stringify-pretty-compact": "^3.0.0",
|
"json-stringify-pretty-compact": "^3.0.0",
|
||||||
"make-fetch-happen": "^14.0.3",
|
"make-fetch-happen": "^14.0.3",
|
||||||
|
|||||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -53,6 +53,9 @@ importers:
|
|||||||
foxact:
|
foxact:
|
||||||
specifier: ^0.2.42
|
specifier: ^0.2.42
|
||||||
version: 0.2.42
|
version: 0.2.42
|
||||||
|
foxts:
|
||||||
|
specifier: 1.0.4
|
||||||
|
version: 1.0.4
|
||||||
hash-wasm:
|
hash-wasm:
|
||||||
specifier: ^4.12.0
|
specifier: ^4.12.0
|
||||||
version: 4.12.0
|
version: 4.12.0
|
||||||
@@ -1150,6 +1153,9 @@ packages:
|
|||||||
react:
|
react:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
foxts@1.0.4:
|
||||||
|
resolution: {integrity: sha512-RMQrpp4uLC2GIuW1G/RvwiHAhYHT2qU5elsOlNtkYibDfMgd+vQWfcP27mmlfy+nIuTYbiI1AB205KxnMsIi9g==}
|
||||||
|
|
||||||
fs-constants@1.0.0:
|
fs-constants@1.0.0:
|
||||||
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
|
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
|
||||||
|
|
||||||
@@ -3015,6 +3021,8 @@ snapshots:
|
|||||||
client-only: 0.0.1
|
client-only: 0.0.1
|
||||||
server-only: 0.0.1
|
server-only: 0.0.1
|
||||||
|
|
||||||
|
foxts@1.0.4: {}
|
||||||
|
|
||||||
fs-constants@1.0.0: {}
|
fs-constants@1.0.0: {}
|
||||||
|
|
||||||
fs-minipass@3.0.3:
|
fs-minipass@3.0.3:
|
||||||
|
|||||||
Reference in New Issue
Block a user