Skip to content

feat(report): host addresses, offline GeoIP country and connect time (#10) - #1818

Closed
nc9 wants to merge 2 commits into
mainfrom
feat/10-host-address-country-latency
Closed

nc9 wants to merge 2 commits into
mainfrom
feat/10-host-address-country-latency

Conversation

@nc9

@nc9 nc9 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Refs #10. Adds a report-only host section (JSON schema 1.17), never scored:

  • Resolved IPv4 and, when present, IPv6 addresses.
  • Hosting country of the first resolved address from a bundled DB-IP Lite country snapshot. Lookups are offline; the field is omitted, not guessed, when the database has no country.
  • Connect time in ms, labelled tcp-connect (not ICMP ping, not page load).
  • Present in JSON, text, console, markdown, HTML, LLM and XML output. Docs updated (docs/cloud/technologies.mdx, docs/configuration/output.mdx).

Edge requirement (Nik): when existing technology detection finds Cloudflare, CloudFront, Vercel, Netlify, Fastly or Akamai, the country is labelled an edge/anycast location (country.location: "edge", country.edge), never the origin's. No new edge detection. Regression tests in packages/audit-engine/tests/host-info.test.ts and packages/report/tests/host-10.test.ts. This also gives #1807 its hook.

Data and licence

  • Source: DB-IP IP to Country Lite, snapshot 2026-11, from db-ip.com only. The download page states CC BY 4.0 with attribution to DB-IP.com.
  • Source file dbip-country-lite-2026-11.csv.gz sha256 e5c8459d638a272ece7f4d7cfa49dce18d91b4f403f6940ba9249bf0db3781fd, recorded in packages/utils/geoip-db/SNAPSHOT.json.
  • Compiled by packages/utils/scripts/build-geoip-db.ts (no network) into country.bin.gz (2.3 MB).
  • Attribution added to README, THIRD_PARTY_NOTICES.md (via its generator) and the docs.
  • Ping is out of scope per the maintainer's A3 decision.

Binary size

apps/cli/build/squirrelscan: 131,029,168 bytes before, 133,339,312 after (+2,310,144, about 2.2 MiB; limit was 10 MB).

Verification

  • bun run typecheck in core-contracts, utils, audit-engine, report, apps/cli; format:check and lint in apps/cli and report.
  • Tests: report (1302), audit-engine (incl. golden), utils (221), cli reports (221) all pass.
  • make validate in docs passes; generate-third-party-notices.ts --check passes.
  • Compiled binary smoke test: embedded lookup returns US and AU for known addresses; a local audit emits host with latency and no country for loopback.
  • Schema version test expectations bumped 1.16 to 1.17.

Agent skill: no change needed (new optional output field only).

Checklist

  • I added or updated tests for behavioral changes.
  • I did not include secrets, customer data, or incompatible third-party material.
  • Every commit includes a DCO Signed-off-by line.

🤖 Generated with Claude Code

… edge-labelled #10

Adds a report-only `host` section (JSON schema 1.17): resolved IPv4/IPv6
addresses, the GeoIP country of the first address, and a TCP connect time
labelled as such. The country comes from a bundled DB-IP Lite country
snapshot (2026-11, CC BY 4.0, source sha256 in packages/utils/geoip-db/
SNAPSHOT.json); lookups are offline and a missing country is omitted.

When existing technology detection finds Cloudflare, CloudFront, Vercel,
Netlify, Fastly or Akamai, the country is labelled an edge/anycast location
and not the origin's, in every output format. No new edge detection.

Attribution is in the README and THIRD_PARTY_NOTICES; compiled CLI grows
by about 2.2 MiB.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>

function parseV6(ip: string): Uint8Array | null {
let text = ip.split("%")[0]!;
const tailV4 = /(\d+\.\d+\.\d+\.\d+)$/.exec(text);
@nc9

nc9 commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: main has the same host, GeoIP and connect-time work (e3c47ac, 5daa09a).

@nc9 nc9 closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants