diff --git a/Build/lib/cached-tld-parse.ts b/Build/lib/cached-tld-parse.ts index 8c1de5a8..8acbf3d3 100644 --- a/Build/lib/cached-tld-parse.ts +++ b/Build/lib/cached-tld-parse.ts @@ -1,19 +1,6 @@ -import * as tldts from 'tldts'; import { createCache } from './cache-apply'; import type { PublicSuffixList } from '@gorhill/publicsuffixlist'; -const cache = createCache('cached-tld-parse', true); -const cache2 = createCache('cached-tld-parse2', true); - -const sharedConfig = { allowPrivateDomains: true }; -const sharedConfig2 = { allowPrivateDomains: true, detectIp: false }; - -/** { allowPrivateDomains: true } */ -export const parse = (domain: string) => cache.sync(domain, () => tldts.parse(domain, sharedConfig)); -/** { allowPrivateDomains: true, detectIp: false } */ -export const parse2 = (domain: string) => cache2.sync(domain, () => tldts.parse(domain, sharedConfig2)); -export const parseWithoutDetectIp = parse2; - let gothillGetDomainCache: ReturnType | null = null; export const createCachedGorhillGetDomain = (gorhill: PublicSuffixList) => { gothillGetDomainCache ??= createCache('cached-gorhill-get-domain', true); diff --git a/Build/lib/normalize-domain.ts b/Build/lib/normalize-domain.ts index 3396f4fe..dfaa8efc 100644 --- a/Build/lib/normalize-domain.ts +++ b/Build/lib/normalize-domain.ts @@ -1,10 +1,10 @@ -import * as tldts from './cached-tld-parse'; +import * as tldts 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.parse2(domain); + const parsed = tldts.parse(domain, { allowPrivateDomains: true, detectIp: false }); // if (parsed.isIp) return null; if (!parsed.hostname) return null; if (!parsed.isIcann && !parsed.isPrivate) return null;