Update Reject & CDN & Domestic & Global Hosts

This commit is contained in:
SukkaW
2024-04-02 22:59:55 +08:00
parent 12b059bdcd
commit 851a5453cf
6 changed files with 62 additions and 10 deletions

View File

@@ -172,7 +172,9 @@ export const buildSpeedtestDomainSet = task(import.meta.path, async (span) => {
// Google Fiber legacy speedtest site (new fiber speedtest use speedtestcustom.com)
'.speed.googlefiber.net',
// librespeed
'.backend.librespeed.org'
'.backend.librespeed.org',
// Apple,
'mensura.cdn-apple.com' // From netQuality command
]);
await span.traceChildAsync('fetch previous speedtest domainset', async () => {

View File

@@ -1,8 +1,8 @@
import { processLine } from './lib/process-line';
import { normalizeDomain } from './lib/normalize-domain';
import { createTrie } from './lib/trie';
import { Readable } from 'stream';
import { parse } from 'csv-parse';
// import { Readable } from 'stream';
import { parse } from 'csv-parse/sync';
import { readFileByLine } from './lib/fetch-text-by-line';
import path from 'path';
@@ -56,12 +56,25 @@ export const parseGfwList = async () => {
const top500Gfwed = new Set<string>();
const res = await fetch('https://radar.cloudflare.com/charts/LargerTopDomainsTable/attachment?id=1077&top=10000');
const stream = Readable.fromWeb(res.body!).pipe(parse());
const res = await (await fetch('https://radar.cloudflare.com/charts/LargerTopDomainsTable/attachment?id=1077&top=10000', {
headers: {
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6,es;q=0.5',
'sec-ch-ua': '"Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
'sec-fetch-dest': 'document',
'sec-fetch-mode': 'navigate',
'sec-fetch-site': 'none',
'sec-fetch-user': '?1',
'upgrade-insecure-requests': '1'
}
})).text();
const topDomains = parse(res);
const trie = createTrie(blackSet);
for await (const [domain] of stream) {
for await (const [domain] of topDomains) {
if (trie.has(domain)) {
top500Gfwed.add(domain);
}