mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-04 04:42:32 +08:00
Perf: only acquire limited data from parse
This commit is contained in:
@@ -54,13 +54,9 @@ const BLACK_TLD = Array.from(new Set([
|
||||
|
||||
const domain = line.charCodeAt(0) === 46 ? line.slice(1) : line;
|
||||
|
||||
if (line.length > 25) {
|
||||
const parsed = tldts.parse(domain, { allowPrivateDomains: true });
|
||||
if (domain.length > 25) {
|
||||
const apexDomain = tldts.getDomain(domain, { allowPrivateDomains: true });
|
||||
|
||||
if (parsed.isIp || domain === parsed.publicSuffix) {
|
||||
continue;
|
||||
}
|
||||
const apexDomain = parsed.domain;
|
||||
if (apexDomain) {
|
||||
if (WHITELIST_DOMAIN.has(apexDomain)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user