From 54b7ea3bd516e29f7087cc0d0fd5d980b84901fe Mon Sep 17 00:00:00 2001 From: Denozordec Date: Sat, 18 Jul 2026 01:01:54 +0700 Subject: [PATCH] feat(lookup): resolve domain to IPs for membership check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Для FQDN после проверки DOMAINS выполняется live DNS (A/AAAA), каждый IP проверяется по IP_RANGES и snapshots; в ответе resolved_ips / resolved_ip, UI KPI и OpenAPI обновлены. Co-authored-by: Cursor --- .../components/lookup/lookup-matches-grid.tsx | 6 +- .../components/lookup/lookup-summary-kpi.tsx | 14 ++- apps/web/src/types/api.ts | 2 + docs/openapi.yaml | 17 +++- internal/httpapi/routes_lookup.go | 2 +- internal/lookup/lookup.go | 99 +++++++++++++++++-- internal/lookup/lookup_test.go | 70 +++++++++++-- 7 files changed, 188 insertions(+), 22 deletions(-) diff --git a/apps/web/src/components/lookup/lookup-matches-grid.tsx b/apps/web/src/components/lookup/lookup-matches-grid.tsx index e8c0754..f4094e8 100644 --- a/apps/web/src/components/lookup/lookup-matches-grid.tsx +++ b/apps/web/src/components/lookup/lookup-matches-grid.tsx @@ -57,7 +57,11 @@ export function LookupMatchesGrid({ cell: ({ row }) => ( ), diff --git a/apps/web/src/components/lookup/lookup-summary-kpi.tsx b/apps/web/src/components/lookup/lookup-summary-kpi.tsx index b2839ed..4e74028 100644 --- a/apps/web/src/components/lookup/lookup-summary-kpi.tsx +++ b/apps/web/src/components/lookup/lookup-summary-kpi.tsx @@ -1,4 +1,4 @@ -import { Layers, ListChecks, Radar } from 'lucide-react' +import { Globe, Layers, ListChecks, Radar } from 'lucide-react' import { KpiStatGrid, type KpiStatItem } from '@/components/reui-kit' import type { LookupResponse } from '@/types/api' @@ -10,6 +10,7 @@ import type { LookupResponse } from '@/types/api' export function LookupSummaryKpi({ data }: { data: LookupResponse }) { const entryCount = data.matches.filter((m) => m.layer === 'entry').length const snapshotCount = data.matches.filter((m) => m.layer === 'snapshot').length + const resolvedCount = data.resolved_ips?.length ?? 0 const items: KpiStatItem[] = [ { @@ -41,6 +42,17 @@ export function LookupSummaryKpi({ data }: { data: LookupResponse }) { }, ] + if (data.query_kind === 'domain') { + items.push({ + id: 'resolved', + label: 'DNS IP', + value: resolvedCount, + hint: resolvedCount > 0 ? data.resolved_ips?.slice(0, 3).join(', ') : 'нет A/AAAA', + icon: , + iconClassName: 'bg-primary text-primary-foreground [&_svg]:text-primary-foreground', + }) + } + return (