Perf: speed up infra

This commit is contained in:
SukkaW
2023-09-13 17:28:34 +08:00
parent c2022ce61d
commit 23c9a963aa
14 changed files with 390 additions and 321 deletions

View File

@@ -27,18 +27,18 @@ const RESERVED_IPV4_CIDR = [
runner(__filename, async () => {
const { exclude } = await import('cidr-tools-wasm');
/** @type {Set<string>} */
const cidr = new Set();
/** @type {string[]} */
const cidr = [];
for await (const line of await fetchRemoteTextAndCreateReadlineInterface('https://raw.githubusercontent.com/misakaio/chnroutes2/master/chnroutes.txt')) {
const l = processLine(line);
if (l) {
cidr.add(l);
cidr.push(l);
}
}
const reversedCidr = exclude(
['0.0.0.0/0'],
RESERVED_IPV4_CIDR.concat(Array.from(cidr)),
RESERVED_IPV4_CIDR.concat(cidr),
true
);