Skip to content

feat(report): detect the edge separately from the origin (#1807) - #1819

Closed
nc9 wants to merge 3 commits into
mainfrom
feat/1807-edge-detection
Closed

nc9 wants to merge 3 commits into
mainfrom
feat/1807-edge-detection

Conversation

@nc9

@nc9 nc9 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #1818. This branch is based on #1818's branch, so until that merges the diff also shows its commit; review only 2214093b and 189c78bd.

Closes #1807 (see the caveats on Google Cloud and Azure Front Door below).

What changes

  • host.edge in the JSON report (schema 1.18) and in the text, markdown, console, HTML, XML and LLM formats: provider, strongest source (header, ip-range or asn), every source that matched, edgeHosted, and origin (identified, edge-hosted or unknown; never the edge itself).
  • host.cloudRange (new in this PR): the address is in a whole-cloud range list (Google Cloud). It is provider information only. It never sets edge, never appears as an edge or alsoMatched source, and never labels the country as an edge location. The report shows it as a "Cloud range" row, and as a cloudRange attribute in XML and LLM output.
  • The Add hosting procvider and server #10 country is labelled an edge location when a header, a CDN-specific range or an edge ASN finds an edge.
  • Existing cdn and hosting technology rows are untouched.

Data (bundled, offline at runtime)

  • DB-IP IP to ASN Lite, snapshot 2026-11, CC BY 4.0 (licence page checked), sha256 in SNAPSHOT.json. Reduced to a fixed list of edge-specific ASNs (Cloudflare, Fastly, Akamai CDN, Vercel). Shared cloud ASNs (AWS, Azure, Google) and Akamai's Linode ASN 63949 are excluded.
  • Official range files only: cloudflare.com/ips (v4, v6), ip-ranges.amazonaws.com (CLOUDFRONT only), api.fastly.com/public-ip-list, gstatic.com/ipranges/cloud.json (provider information only, see below), Microsoft Service Tags (AzureFrontDoor.Frontend only). No Akamai, Vercel or Netlify ranges.
  • scripts/refresh-edge-data.ts re-downloads, records the fetch date and sha256 of every file, and rewrites the bundled files. Attribution in README, both THIRD_PARTY_NOTICES (generator updated) and docs.
  • Compiled CLI (non-minified build): 133,961,904 bytes against the 131,029,168 pre-Add hosting procvider and server #10 baseline, +2,932,736 bytes (about 2.8 MiB) for Add hosting procvider and server #10 and Detect edge hosting (CDN or edge platform) separately from the origin host, from headers, IP ranges and ASN #1807 combined. The size was measured at 2214093b. 189c78bd changes code only, not the bundled data, and its size was not re-measured.

Caveats to review

  • Google Cloud: Google publishes no Cloud CDN-only list, and Via: 1.1 google is shared with other products. cloud.json covers all of Google Cloud, including a plain Compute Engine VM, so a match says only that the address is in Google Cloud's published ranges. Per the lead decision, that is reported as host.cloudRange and never as an edge, and the country is not labelled an edge location because of it. Google Cloud CDN is therefore never detected. The country of such an address is still shown as the ordinary hosting country, as it is for any address with no edge.
  • Azure Front Door already had a header fingerprint (x-azure-ref) on this base; only Frontend ranges are bundled, not Backend, FirstParty or MicrosoftSecurity.
  • Netlify has no range list and no ASN of its own in the database: header only.

Tests

  • 189c78bd: a whole-cloud address alone is not an edge (no edge, country not an edge location, cloudRange set); beside a real edge it leaves the edge unchanged; the Cloud range row and JSON carry it with no Edge row. edge-1807, host-info and host-10 tests: 69 pass.
  • Earlier: header fixtures (each provider alone, lookalike names rejected), IP fixtures (inside and just outside ranges, IPv6, mapped IPv4), ASN fixtures, edge-hosted, origin behind an edge, a refresh-record check and a coverage check that fails if a listed provider is missing.
  • make check (format, lint, typecheck) passes; bun test packages/report packages/utils packages/core-contracts: 2465 pass.

Agent skill

No change needed: the skill does not describe the host section.

bun.lock has a pre-existing local change that is not part of this PR.

nc9 and others added 2 commits November 13, 2026 04:31
… 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]>
…SN, apart from the origin (#1807)

Adds `host.edge` (JSON schema 1.18): the CDN or edge platform answering for
the host, the strongest matching source (header, ip-range or asn) and every
source that agreed, an edgeHosted flag for Vercel, Netlify and Cloudflare
Pages, and the origin kept separate (identified, edge-hosted or unknown,
never the edge). The country is labelled an edge location when any source
finds an edge.

Data is bundled and matched offline. scripts/refresh-edge-data.ts is the
only code that fetches it and records the fetch date and sha256 of every
file: Cloudflare, CloudFront (CLOUDFRONT service only), Fastly, Google
Cloud (cloud.json, marked broad: it is not Cloud CDN specific) and Azure
Front Door (AzureFrontDoor.Frontend) ranges, plus DB-IP IP to ASN Lite
(CC BY 4.0) reduced to edge-specific ASNs. Akamai, Vercel and Netlify have
no range list and stay header or ASN detected.

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

export function parseV6(ip: string): Uint8Array | null {
let text = ip.split("%")[0]!;
const tailV4 = /(\d+\.\d+\.\d+\.\d+)$/.exec(text);
sourceSha256: sha(asnRaw),
keptAsns: [...wanted.keys()].length,
},
rangeSources: sources.filter((s) => !s.url.includes("db-ip.com")).map((s) => ({ ...s, fetchedAt })),
Comment thread scripts/refresh-edge-data.ts Dismissed
Comment thread scripts/refresh-edge-data.ts Dismissed
… an edge (#1807)

Google's cloud.json lists every Google Cloud range, including a plain
Compute Engine VM, and Google publishes no Cloud CDN-only list. A match
no longer sets host.edge, labels the country as an edge location, or
appears as an edge or alsoMatched source. It is reported as
host.cloudRange (provider, address) and as a "Cloud range" row that says
it is not evidence of a CDN or edge. The edge is set only by a header or
a CDN-specific range or ASN. The range data is unchanged. The schema stays
1.18, which is not yet released.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9

nc9 commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: main has the edge detection work (a1c5c9c, 872ab75, 221ffc6) as report schema 1.18.

@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.

Detect edge hosting (CDN or edge platform) separately from the origin host, from headers, IP ranges and ASN

2 participants