Chore: use foxts/counter
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled

This commit is contained in:
SukkaW
2026-06-08 15:01:05 +08:00
parent d44c8affad
commit 4c720e8921
3 changed files with 117 additions and 116 deletions

View File

@@ -14,6 +14,7 @@ import { processHostsWithPreload } from './parse-filter/hosts';
import { processDomainListsWithPreload } from './parse-filter/domainlists';
import process from 'node:process';
import { Counter } from 'foxts/counter';
export function getPhishingDomains(rawSpan?: RawSpan, isDebug = false): Promise<WorkerJobResult<string[]>> {
return workerJob(rawSpan, async (childSpan) => {
@@ -29,7 +30,7 @@ export function getPhishingDomains(rawSpan?: RawSpan, isDebug = false): Promise<
domainGroups.forEach(appendArrayInPlaceCurried(domainArr));
const domainCountMap = new Map<string, number>();
const domainCountMap = new Counter();
const domainScoreMap: Record<string, number> = Object.create(null) as Record<string, number>;
let line: string;
@@ -61,12 +62,7 @@ export function getPhishingDomains(rawSpan?: RawSpan, isDebug = false): Promise<
continue;
}
domainCountMap.set(
apexDomain,
domainCountMap.has(apexDomain)
? domainCountMap.get(apexDomain)! + 1
: 1
);
domainCountMap.incr(apexDomain);
let score = 0;