mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Add internal china domains list
This commit is contained in:
25
Build/build-internal-chn-domains.js
Normal file
25
Build/build-internal-chn-domains.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// @ts-check
|
||||
const { fetchRemoteTextAndCreateReadlineInterface } = require('./lib/fetch-remote-text-by-line');
|
||||
const { processLine } = require('./lib/process-line');
|
||||
const path = require('path');
|
||||
const fse = require('fs-extra');
|
||||
const fs = require('fs');
|
||||
|
||||
(async () => {
|
||||
/** @type {Set<string>} */
|
||||
const result = new Set();
|
||||
for await (const line of await fetchRemoteTextAndCreateReadlineInterface('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf')) {
|
||||
const l = processLine(line);
|
||||
if (l) {
|
||||
result.add(
|
||||
l.replace('server=/', '').replace('/114.114.114.114', '')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await fse.ensureDir(path.resolve(__dirname, '../List/internal'));
|
||||
await fs.promises.writeFile(
|
||||
path.resolve(__dirname, '../List/internal/accelerated-china-domains.txt'),
|
||||
`${Array.from(result).map(line => `SUFFIX,${line}`).join('\n')}\n`
|
||||
);
|
||||
})();
|
||||
Reference in New Issue
Block a user