mirror of
https://gitlab.com/SukkaW/ruleset.skk.moe.git
synced 2026-01-02 10:30:26 +00:00
deploy: 1586fe73c1f6ae8ef683d772580403d5066aee6e
This commit is contained in:
@@ -4,6 +4,8 @@ const path = require('path');
|
||||
const { isIP } = require('net');
|
||||
|
||||
(async () => {
|
||||
console.time('build-anti-bogus-domain Total Time');
|
||||
console.time('* Download bogus-nxdomain-list')
|
||||
const res = (await (await fetchWithRetry('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/bogus-nxdomain.china.conf')).text())
|
||||
.split('\n')
|
||||
.map(line => {
|
||||
@@ -14,6 +16,7 @@ const { isIP } = require('net');
|
||||
return null
|
||||
})
|
||||
.filter(ip => typeof ip === 'string' && isIP(ip) !== 0);
|
||||
console.timeEnd('* Download bogus-nxdomain-list')
|
||||
|
||||
const filePath = path.resolve(__dirname, '../List/ip/reject.conf');
|
||||
const content = (await fs.promises.readFile(filePath, 'utf-8'))
|
||||
@@ -23,4 +26,5 @@ const { isIP } = require('net');
|
||||
);
|
||||
|
||||
await fs.promises.writeFile(filePath, content, 'utf-8');
|
||||
console.timeEnd('build-anti-bogus-domain Total Time');
|
||||
})();
|
||||
|
||||
@@ -5,6 +5,8 @@ const path = require('path');
|
||||
const rDomain = /^(((?!\-))(xn\-\-)?[a-z0-9\-_]{0,61}[a-z0-9]{1,1}\.)*(xn\-\-)?([a-z0-9\-]{1,61}|[a-z0-9\-]{1,30})\.[a-z]{2,}$/m;
|
||||
|
||||
(async () => {
|
||||
console.time('Total Time - build-apple-cdn-conf');
|
||||
|
||||
const res = (await (await fetchWithRetry('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf')).text())
|
||||
.split('\n')
|
||||
.map(line => {
|
||||
@@ -28,4 +30,6 @@ const rDomain = /^(((?!\-))(xn\-\-)?[a-z0-9\-_]{0,61}[a-z0-9]{1,1}\.)*(xn\-\-)?(
|
||||
'utf-8'
|
||||
)
|
||||
])
|
||||
|
||||
console.timeEnd('Total Time - build-apple-cdn-conf');
|
||||
})();
|
||||
|
||||
@@ -3,6 +3,8 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
(async () => {
|
||||
console.time('Total Time - build-cdn-conf');
|
||||
|
||||
const domains = (await (await fetchWithRetry('https://publicsuffix.org/list/public_suffix_list.dat')).text()).split('\n');
|
||||
|
||||
const S3OSSDomains = domains.filter(line => {
|
||||
@@ -29,4 +31,6 @@ const path = require('path');
|
||||
);
|
||||
|
||||
await fs.promises.writeFile(filePath, content, 'utf-8');
|
||||
|
||||
console.timeEnd('Total Time - build-cdn-conf');
|
||||
})();
|
||||
|
||||
@@ -3,6 +3,8 @@ const { promises: fsPromises } = require('fs');
|
||||
const { resolve: pathResolve } = require('path');
|
||||
|
||||
(async () => {
|
||||
console.time('Total Time - build-chnroutes-cidr');
|
||||
|
||||
const cidr = (await (await fetchWithRetry('https://raw.githubusercontent.com/misakaio/chnroutes2/master/chnroutes.txt')).text()).split('\n');
|
||||
|
||||
const filteredCidr = cidr.filter(line => {
|
||||
@@ -13,7 +15,9 @@ const { resolve: pathResolve } = require('path');
|
||||
return false;
|
||||
})
|
||||
|
||||
return fsPromises.writeFile(pathResolve(__dirname, '../List/ip/china_ip.conf'), makeCidrList(filteredCidr), { encoding: 'utf-8' });
|
||||
await fsPromises.writeFile(pathResolve(__dirname, '../List/ip/china_ip.conf'), makeCidrList(filteredCidr), { encoding: 'utf-8' });
|
||||
|
||||
console.timeEnd('Total Time - build-chnroutes-cidr');
|
||||
})();
|
||||
|
||||
function makeCidrList(cidr) {
|
||||
|
||||
@@ -7,7 +7,7 @@ const { isCI } = require('ci-info');
|
||||
const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
|
||||
(async () => {
|
||||
console.time('Total time');
|
||||
console.time('Total Time - build-reject-domain-set');
|
||||
|
||||
/** @type Set<string> */
|
||||
const domainSets = new Set();
|
||||
@@ -267,10 +267,10 @@ const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
console.timeEnd(`* Dedupe from covered subdomain`);
|
||||
console.log(`Deduped ${previousSize - domainSets.size} rules!`);
|
||||
|
||||
console.timeEnd('Total time');
|
||||
|
||||
return fsPromises.writeFile(
|
||||
await fsPromises.writeFile(
|
||||
pathResolve(__dirname, '../List/domainset/reject.conf'),
|
||||
`${[...domainSets].join('\n')}\n`,
|
||||
{ encoding: 'utf-8' });
|
||||
|
||||
console.time('Total Time - build-reject-domain-set');
|
||||
})();
|
||||
|
||||
@@ -4,6 +4,8 @@ const path = require('path');
|
||||
const { isIPv4, isIPv6 } = require('net');
|
||||
|
||||
(async () => {
|
||||
console.time('Total Time - build-telegram-cidr');
|
||||
|
||||
const resp = await fetchWithRetry('https://core.telegram.org/resources/cidr.txt');
|
||||
const lastModified = new Date(resp.headers.get('last-modified'));
|
||||
|
||||
@@ -27,4 +29,6 @@ const { isIPv4, isIPv6 } = require('net');
|
||||
}).join('\n') + '\n',
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
console.timeEnd('Total Time - build-telegram-cidr');
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user