deploy: b72a0b3a3efa9f5884b64e897549a02faef19293

This commit is contained in:
SukkaBot
2022-05-14 01:45:27 +00:00
parent bc17621dea
commit 4936705603
8 changed files with 670 additions and 825 deletions

View File

@@ -2,7 +2,7 @@ const { promises: fsPromises } = require('fs');
const { resolve: pathResolve } = require('path');
const Piscina = require('piscina');
const { processHosts, processFilterRules } = require('./lib/parse-filter');
const threads = Math.max(require('os').cpus().length, 12);
const threads = require('os').cpus().length - 1;
(async () => {
/** @type Set<string> */
@@ -144,24 +144,23 @@ const threads = Math.max(require('os').cpus().length, 12);
console.log(`Start deduping! (${beforeDeduping})`);
const piscina = new Piscina({
filename: pathResolve(__dirname, 'worker/build-reject-domainset-worker.js')
filename: pathResolve(__dirname, 'worker/build-reject-domainset-worker.js'),
workerData: domainSets
});
(await Promise.all([
piscina.run(
{ keywords: domainKeywordsSet, suffixes: domainSuffixSet, input: domainSets },
{ keywords: domainKeywordsSet, suffixes: domainSuffixSet },
{ name: 'dedupeKeywords' }
),
piscina.run(
{ whiteList: filterRuleWhitelistDomainSets, input: domainSets },
{ whiteList: filterRuleWhitelistDomainSets },
{ name: 'whitelisted' }
)
])).forEach(set => {
set.forEach(i => domainSets.delete(i));
});
const originalFullSet = new Set([...domainSets]);
(await Promise.all(
Array.from(domainSets)
.reduce((result, element, index) => {
@@ -172,7 +171,7 @@ const threads = Math.max(require('os').cpus().length, 12);
return result;
}, [])
.map(chunk => piscina.run(
{ input: chunk, fullSet: originalFullSet },
{ chunk },
{ name: 'dedupe' }
))
)).forEach(set => {

View File

@@ -16,7 +16,7 @@ const { isIPv4, isIPv6 } = require('net');
'# Telegram CIDR (https://core.telegram.org/resources/cidr.txt)' + '\n' +
'# Last Updated: ' + lastModified.toISOString() + '\n' +
res.map(ip => {
const [subnet, range] = ip.split('/');
const [subnet] = ip.split('/');
if (isIPv4(subnet)) {
return `IP-CIDR,${ip},no-resolve`;
}

View File

@@ -1,15 +1,16 @@
exports.dedupe = ({ fullSet, input }) => {
const { workerData } = require('piscina');
exports.dedupe = ({ chunk }) => {
const outputToBeRemoved = new Set();
for (const domainFromInput of input) {
for (const domainFromFullSet of fullSet) {
for (const domainFromInput of chunk) {
for (const domainFromFullSet of workerData) {
if (domainFromFullSet === domainFromInput) continue;
if (domainFromFullSet.charAt(0) !== '.') continue;
if (
domainFromFullSet.startsWith('.')
&& domainFromFullSet !== domainFromInput
&& (
domainFromInput.endsWith(domainFromFullSet)
|| `.${domainFromInput}` === domainFromFullSet
)
`.${domainFromInput}` === domainFromFullSet
|| domainFromInput.endsWith(domainFromFullSet)
) {
outputToBeRemoved.add(domainFromInput);
break;
@@ -20,10 +21,10 @@ exports.dedupe = ({ fullSet, input }) => {
return outputToBeRemoved;
};
exports.whitelisted = ({ whiteList, input }) => {
exports.whitelisted = ({ whiteList }) => {
const outputToBeRemoved = new Set();
for (const domain of input) {
for (const domain of workerData) {
for (const white of whiteList) {
if (domain.includes(white) || white.includes(domain)) {
outputToBeRemoved.add(domain);
@@ -35,10 +36,10 @@ exports.whitelisted = ({ whiteList, input }) => {
return outputToBeRemoved;
};
exports.dedupeKeywords = ({ keywords, suffixes, input }) => {
exports.dedupeKeywords = ({ keywords, suffixes }) => {
const outputToBeRemoved = new Set();
for (const domain of input) {
for (const domain of workerData) {
for (const keyword of keywords) {
if (domain.includes(keyword) || keyword.includes(domain)) {
outputToBeRemoved.add(domain);

View File

@@ -234,6 +234,8 @@ imagizer.imageshack.com
# Uploadcare
.shgcdn.com
.ucarecdn.com
# Cloudflare Images
.imagedelivery.net
# Other Image Server
.z4a.net
i.jpg.dog

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@
<main class="container">
<h1>Sukka Surge Ruleset Server</h1>
<p>Made by <a href="https://skk.moe">Sukka</a> | <a href="https://github.com/SukkaW/Surge/">Source @ GitHub</a> | Licensed under <a href="https://github.com/SukkaW/Surge/blob/master/LICENSE" target="_blank">AGPL-3.0</a></p>
<p>Last Updated: 2022-05-13T12:54:40.874Z</p>
<p>Last Updated: 2022-05-14T01:45:26.185Z</p>
<hr>
<br>
<ul>

141
package-lock.json generated
View File

@@ -11,12 +11,12 @@
"dependencies": {
"@sukka/listdir": "^0.2.0",
"picocolors": "^1.0.0",
"piscina": "^3.1.0",
"table": "^6.7.3",
"undici": "^5.0.0"
"piscina": "^3.2.0",
"table": "^6.8.0",
"undici": "^5.2.0"
},
"devDependencies": {
"wireit": "^0.2.0"
"wireit": "^0.4.2"
}
},
"node_modules/@actions/cache": {
@@ -727,6 +727,12 @@
"node": ">= 6"
}
},
"node_modules/graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
"dev": true
},
"node_modules/hdr-histogram-js": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/hdr-histogram-js/-/hdr-histogram-js-2.0.1.tgz",
@@ -806,6 +812,12 @@
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
},
"node_modules/jsonc-parser": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz",
"integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==",
"dev": true
},
"node_modules/lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
@@ -949,9 +961,9 @@
}
},
"node_modules/piscina": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/piscina/-/piscina-3.1.0.tgz",
"integrity": "sha512-KTW4sjsCD34MHrUbx9eAAbuUSpVj407hQSgk/6Epkg0pbRBmv4a3UX7Sr8wxm9xYqQLnsN4mFOjqGDzHAdgKQg==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/piscina/-/piscina-3.2.0.tgz",
"integrity": "sha512-yn/jMdHRw+q2ZJhFhyqsmANcbF6V2QwmD84c6xRau+QpQOmtrBCoRGdvTfeuFDYXB5W2m6MfLkjkvQa9lUSmIA==",
"dependencies": {
"eventemitter-asyncresource": "^1.0.0",
"hdr-histogram-js": "^2.0.1",
@@ -970,6 +982,17 @@
"node": ">= 0.6.0"
}
},
"node_modules/proper-lockfile": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz",
"integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==",
"dev": true,
"dependencies": {
"graceful-fs": "^4.2.4",
"retry": "^0.12.0",
"signal-exit": "^3.0.2"
}
},
"node_modules/psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
@@ -1024,6 +1047,15 @@
"node": ">=0.10.0"
}
},
"node_modules/retry": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
"integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",
"dev": true,
"engines": {
"node": ">= 4"
}
},
"node_modules/reusify": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
@@ -1072,6 +1104,12 @@
"semver": "bin/semver.js"
}
},
"node_modules/signal-exit": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
"node_modules/slice-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
@@ -1113,9 +1151,9 @@
}
},
"node_modules/table": {
"version": "6.7.3",
"resolved": "https://registry.npmjs.org/table/-/table-6.7.3.tgz",
"integrity": "sha512-5DkIxeA7XERBqMwJq0aHZOdMadBx4e6eDoFRuyT5VR82J0Ycg2DwM6GfA/EQAhJ+toRTaS1lIdSQCqgrmhPnlw==",
"version": "6.8.0",
"resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz",
"integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==",
"dependencies": {
"ajv": "^8.0.1",
"lodash.truncate": "^4.4.2",
@@ -1175,9 +1213,9 @@
}
},
"node_modules/undici": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.0.0.tgz",
"integrity": "sha512-VhUpiZ3No1DOPPQVQnsDZyfcbTTcHdcgWej1PdFnSvOeJmOVDgiOHkunJmBLfmjt4CqgPQddPVjSWW0dsTs5Yg==",
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.2.0.tgz",
"integrity": "sha512-XY6+NS3WH9b3TKOHeNz2CjR+qrVz/k4fO9g3etPpLozRvULoQmZ1+dk9JbIz40ehn27xzFk4jYVU2MU3Nle62A==",
"engines": {
"node": ">=12.18"
}
@@ -1226,20 +1264,23 @@
}
},
"node_modules/wireit": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/wireit/-/wireit-0.2.0.tgz",
"integrity": "sha512-iE+i8PBthGdSrtAhUv+hRv7UV5tsJtAKMs+h1sIZE5ciEqH6kwGqtyirIldxrkSqpn1MfL6tGiQSdas77zPSGQ==",
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/wireit/-/wireit-0.4.2.tgz",
"integrity": "sha512-zzrlhLgDPMLC+NQGur7lmMfDzTT+DCOkTg6i8nJaX3LLcgb9J9APiychNaMZqdwZ1VNDWPIxdmO5Zz0RlE2U1A==",
"dev": true,
"dependencies": {
"@actions/cache": "=2.0.2",
"braces": "^3.0.2",
"chokidar": "^3.5.3",
"fast-glob": "^3.2.11"
"fast-glob": "^3.2.11",
"jsonc-parser": "^3.0.0",
"proper-lockfile": "^4.1.2"
},
"bin": {
"wireit": "bin/wireit.js"
},
"engines": {
"node": ">=16.7.0"
"node": ">=14.14.0"
}
},
"node_modules/xml2js": {
@@ -1853,6 +1894,12 @@
"is-glob": "^4.0.1"
}
},
"graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
"dev": true
},
"hdr-histogram-js": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/hdr-histogram-js/-/hdr-histogram-js-2.0.1.tgz",
@@ -1914,6 +1961,12 @@
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
},
"jsonc-parser": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz",
"integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==",
"dev": true
},
"lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
@@ -2013,9 +2066,9 @@
"dev": true
},
"piscina": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/piscina/-/piscina-3.1.0.tgz",
"integrity": "sha512-KTW4sjsCD34MHrUbx9eAAbuUSpVj407hQSgk/6Epkg0pbRBmv4a3UX7Sr8wxm9xYqQLnsN4mFOjqGDzHAdgKQg==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/piscina/-/piscina-3.2.0.tgz",
"integrity": "sha512-yn/jMdHRw+q2ZJhFhyqsmANcbF6V2QwmD84c6xRau+QpQOmtrBCoRGdvTfeuFDYXB5W2m6MfLkjkvQa9lUSmIA==",
"requires": {
"eventemitter-asyncresource": "^1.0.0",
"hdr-histogram-js": "^2.0.1",
@@ -2029,6 +2082,17 @@
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
"dev": true
},
"proper-lockfile": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz",
"integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.4",
"retry": "^0.12.0",
"signal-exit": "^3.0.2"
}
},
"psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
@@ -2060,6 +2124,12 @@
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="
},
"retry": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
"integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",
"dev": true
},
"reusify": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
@@ -2087,6 +2157,12 @@
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true
},
"signal-exit": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
"slice-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
@@ -2116,9 +2192,9 @@
}
},
"table": {
"version": "6.7.3",
"resolved": "https://registry.npmjs.org/table/-/table-6.7.3.tgz",
"integrity": "sha512-5DkIxeA7XERBqMwJq0aHZOdMadBx4e6eDoFRuyT5VR82J0Ycg2DwM6GfA/EQAhJ+toRTaS1lIdSQCqgrmhPnlw==",
"version": "6.8.0",
"resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz",
"integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==",
"requires": {
"ajv": "^8.0.1",
"lodash.truncate": "^4.4.2",
@@ -2166,9 +2242,9 @@
"dev": true
},
"undici": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.0.0.tgz",
"integrity": "sha512-VhUpiZ3No1DOPPQVQnsDZyfcbTTcHdcgWej1PdFnSvOeJmOVDgiOHkunJmBLfmjt4CqgPQddPVjSWW0dsTs5Yg=="
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.2.0.tgz",
"integrity": "sha512-XY6+NS3WH9b3TKOHeNz2CjR+qrVz/k4fO9g3etPpLozRvULoQmZ1+dk9JbIz40ehn27xzFk4jYVU2MU3Nle62A=="
},
"universalify": {
"version": "0.1.2",
@@ -2207,14 +2283,17 @@
}
},
"wireit": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/wireit/-/wireit-0.2.0.tgz",
"integrity": "sha512-iE+i8PBthGdSrtAhUv+hRv7UV5tsJtAKMs+h1sIZE5ciEqH6kwGqtyirIldxrkSqpn1MfL6tGiQSdas77zPSGQ==",
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/wireit/-/wireit-0.4.2.tgz",
"integrity": "sha512-zzrlhLgDPMLC+NQGur7lmMfDzTT+DCOkTg6i8nJaX3LLcgb9J9APiychNaMZqdwZ1VNDWPIxdmO5Zz0RlE2U1A==",
"dev": true,
"requires": {
"@actions/cache": "=2.0.2",
"braces": "^3.0.2",
"chokidar": "^3.5.3",
"fast-glob": "^3.2.11"
"fast-glob": "^3.2.11",
"jsonc-parser": "^3.0.0",
"proper-lockfile": "^4.1.2"
}
},
"xml2js": {

View File

@@ -58,11 +58,11 @@
"dependencies": {
"@sukka/listdir": "^0.2.0",
"picocolors": "^1.0.0",
"piscina": "^3.1.0",
"table": "^6.7.3",
"undici": "^5.0.0"
"piscina": "^3.2.0",
"table": "^6.8.0",
"undici": "^5.2.0"
},
"devDependencies": {
"wireit": "^0.2.0"
"wireit": "^0.4.2"
}
}