Chore: better logging

This commit is contained in:
SukkaW
2022-09-22 22:57:00 +08:00
parent d5f0f2428f
commit 8a7f32e2cd
9 changed files with 47 additions and 12 deletions

View File

@@ -4,6 +4,8 @@ const path = require('path');
const { isIP } = require('net');
(async () => {
console.time('Total Time - build-anti-bogus-domain');
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('Total Time - build-anti-bogus-domain');
})();