mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Perf: use tldts-experimental when possible
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import * as tldts from 'tldts';
|
||||
import { parse as tldtsParse } from 'tldts';
|
||||
import { isProbablyIpv4 } from './is-fast-ip';
|
||||
export const normalizeDomain = (domain: string) => {
|
||||
if (!domain) return null;
|
||||
if (isProbablyIpv4(domain)) return null;
|
||||
|
||||
const parsed = tldts.parse(domain, { allowPrivateDomains: true, detectIp: false });
|
||||
const parsed = tldtsParse(domain, { allowPrivateDomains: true, detectIp: false });
|
||||
// if (parsed.isIp) return null;
|
||||
if (!parsed.hostname) return null;
|
||||
if (!parsed.isIcann && !parsed.isPrivate) return null;
|
||||
|
||||
Reference in New Issue
Block a user