mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Drop gorhill publicsuffixlist
This commit is contained in:
@@ -5,12 +5,10 @@ import { bench, group, run } from 'mitata';
|
||||
|
||||
import * as tldts from 'tldts';
|
||||
import * as tldtsExperimental from 'tldts-experimental';
|
||||
import { getGorhillPublicSuffixPromise } from './get-gorhill-publicsuffix';
|
||||
|
||||
(async () => {
|
||||
const data = await processLineFromReadline(await fetchRemoteTextByLine('https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt'));
|
||||
|
||||
const gorhill = await getGorhillPublicSuffixPromise();
|
||||
const tldtsOpt: Parameters<typeof tldts.getDomain>[1] = {
|
||||
allowPrivateDomains: false,
|
||||
extractHostname: false,
|
||||
@@ -21,18 +19,6 @@ import { getGorhillPublicSuffixPromise } from './get-gorhill-publicsuffix';
|
||||
|
||||
(['getDomain', 'getPublicSuffix', 'getSubdomain', 'parse'] as const).forEach(methodName => {
|
||||
group(methodName, () => {
|
||||
if (methodName in gorhill) {
|
||||
bench('gorhill', () => {
|
||||
for (let i = 0, len = data.length; i < len; i++) {
|
||||
const line = data[i];
|
||||
const safeGorhillLine = line[0] === '.' ? line.slice(1) : line;
|
||||
|
||||
// @ts-expect-error -- type guarded
|
||||
gorhill[methodName](safeGorhillLine);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bench('tldts', () => {
|
||||
for (let i = 0, len = data.length; i < len; i++) {
|
||||
tldts[methodName](data[i], tldtsOpt);
|
||||
|
||||
Reference in New Issue
Block a user