A small, open-source English-language network diagnostic tool for https://ip.lukasberan.cz. One Cloudflare Worker serves a vanilla frontend with Static Assets and a narrow TypeScript API. No accounts, cookies, analytics, database, or paid Cloudflare bindings.
All interface text and country/time formatting use English, regardless of browser language. Organization and location names are displayed as supplied by the data providers.
- Independent, concurrent browser checks for public IPv4 and IPv6 using
https://api.ipify.org?format=jsonandhttps://api6.ipify.org?format=json. - Five-second detection deadlines and independent loading/error states.
- Server-side IPinfo Lite ASN, AS organization/domain, country, and continent data.
- IPv4/IPv6 PTR resolution through Cloudflare DNS over HTTPS, including multiple answers and classless reverse zones. Only PTR records belonging to the queried name or its CNAME chain are returned.
- Directly observed Cloudflare connection address and available ASN, location, timezone, colo, HTTP, and TLS metadata.
- Explicitly labelled Cloudflare fallbacks, copy buttons, refresh without page navigation, responsive layout, accessible controls, and a dark-blue visual theme consistent with the DNS lookup tool.
- Strict public-IP validation, bounded bodies, fixed upstream URLs, restrictive
security headers, and
no-storeon every API response.
The browser contacts ipify directly: a Worker-side ipify request would discover the Worker's egress address, not the visitor's. A single dual-stack connection only reveals the family actually used. An unsuccessful IPv6 test is inconclusive: connectivity, DNS, a content blocker, or ipify itself may be responsible. IPv4 and IPv6 may use different networks or VPN exits.
Cloudflare metadata is attached only to the address observed on that particular
API request. In Pseudo IPv4 Overwrite Headers mode the Worker recovers the IPv6
address from CF-Connecting-IPv6. In Add Header mode it keeps the native IPv6
address and shows a valid CF-Pseudo-IPv4 in the technical details. If the page
script is unavailable, a link opens the connection API directly.
The shared ipaddr.js parser is bundled into the browser JavaScript using esbuild.
The frontend uses no framework, CDN scripts, external fonts, or runtime build
service. Wrangler builds public/app.js from the TypeScript sources before
development and deployment. The generated file is ignored by Git.
- Node.js 22.22.2+ on the 22.x line, 24.15.0+ on the 24.x line, or 26+, and npm.
.node-versionpins 24.15.0 for reproducible hosting builds. - A Cloudflare account on Workers Free.
- An active Cloudflare DNS zone for
lukasberan.czto use the Custom Domain. - An IPinfo Lite token for enrichment; detection and DNS still work without it.
- A modern browser with JavaScript. Clipboard access requires HTTPS or localhost.
git clone https://github.com/luberan/ip-info.git
cd ip-info
npm ciIn PowerShell, create the optional local secret file:
Copy-Item .dev.vars.example .dev.varsOn macOS/Linux, use cp .dev.vars.example .dev.vars. Edit .dev.vars locally and
set IPINFO_TOKEN to your token, or leave it empty to test graceful degradation.
Do not commit this file.
npm run devOpen the localhost URL printed by Wrangler (normally http://localhost:8787).
Wrangler watches the static assets and rebuilds the Worker and browser bundle
when files under src change.
request.cf and trusted visitor headers may be absent or incomplete locally.
Unavailable values are intentional; local loopback addresses are never enriched
or presented as public detection fallbacks. Do not treat manually supplied
Cloudflare headers as authenticated metadata outside Cloudflare's edge.
npm test
npm run test:smokeVitest uses mocked HTTP responses, never live ipify, IPinfo, or DNS dependencies. Tests cover strict address parsing and special-purpose ranges, compressed and embedded IPv6 PTR names, request limits, methods/origins, missing metadata/token, partial failures, timeouts (including stalled bodies), no-store headers, browser concurrency, fallback association, safe DOM rendering, stale refresh cancellation, and clipboard errors. Browser tests use jsdom; production has no jsdom dependency.
npm run test:smoke runs npm run build once. This type-checks the Worker and
browser code, bundles the browser assets, and builds the Worker in .wrangler/build
with wrangler deploy --dry-run. Both smoke suites use that Worker bundle.
Wrangler's local runtime checks asset and API routing, 404 pages, UTF-8 validation,
HTTP methods, security headers and cache policy. A second local runtime intercepts
all outbound requests to verify IPv4 and IPv6 network and PTR results, including
the case where IPinfo fails and reverse DNS succeeds. The suites run without
Cloudflare credentials or requests to live lookup providers.
GitHub Actions runs tests, type checks, build validation, runtime smoke checks
and a dependency audit on pull requests, pushes to main, weekly, and on manual request.
The main job uses the production Node version from .node-version; compatibility
jobs also test the supported Node 22 minimum and current Node 26 releases.
- GitHub manages CodeQL through its default setup with extended security queries for JavaScript/TypeScript and GitHub Actions. The configuration lives under Settings → Advanced Security → Code scanning.
- Dependabot: weekly npm and GitHub Actions update PRs. Patch/minor updates are grouped; major upgrades remain separate. Security update PRs have their own group. Updates are never automatically merged.
- Dependency review: pull requests introducing known high/critical
vulnerabilities receive a failed check, including development dependencies.
The CI job also runs
npm audit --audit-level=highagainst the full lockfile so newly disclosed vulnerabilities in unchanged packages are checked as well. - OpenSSF Scorecard: trusted-branch and weekly supply-chain posture checks, uploaded to GitHub's code-scanning dashboard. Results are not published to a separate external Scorecard service and need no extra token.
- Secret protection: keep secret scanning and push protection enabled. Supported-pattern scanning is not a guarantee that every IPinfo or other token format will be recognized. Never rely on it instead of keeping secrets out of Git. Optional generic-pattern scanning and partner-token validity checks require an eligible organization/Secret Protection plan and are not enabled by this setup.
- Private vulnerability reports: use the process in the security policy.
GitHub Actions requires a full-length commit SHA for action references in
workflows, including GitHub's own actions. The default GITHUB_TOKEN has
read-only permissions, and workflows cannot use it to approve pull requests.
The workflows in this repository use GitHub-hosted Ubuntu runners and disable
credential persistence during checkout. The Scorecard job explicitly requests
security-events: write to upload its findings. Pull request checks run on
pull_request with read-only permissions. CI caches npm downloads and keeps
test output in the job logs.
Direct fast-forward pushes to main are allowed. The
Protect main history ruleset
blocks force-pushes and branch deletion with no bypass exceptions. Pull requests,
review approvals and passing status checks are optional. Cloudflare Workers Builds
runs its own build and deployment on pushes to main, independently of GitHub
Actions. Production credentials stay in Cloudflare.
Standard GitHub-hosted runner compute is free for public repositories. Larger runners, storage overages, and optional paid security features have separate billing rules; this setup does not enable them.
Accepted Scorecard findings and their reassessment conditions are documented in the security policy. Closing an accepted repository recommendation is not a claim that an application vulnerability was fixed; all scanners remain enabled.
Both endpoints return UTF-8 JSON and set Cache-Control: no-store,
CDN-Cache-Control: no-store, and Cloudflare-CDN-Cache-Control: no-store.
No personalized response is placed in the Workers Cache API.
{
"ip": "2001:4860:4860::8888",
"family": "ipv6",
"ipSource": "cf-connecting-ip",
"pseudoIpv4": null,
"reason": null,
"metadata": {
"asn": null,
"asOrganization": null,
"country": null,
"region": null,
"city": null,
"timezone": null,
"colo": null,
"httpProtocol": null,
"tlsVersion": null
}
}This is an illustrative shape, not real visitor data. Missing fields are null.
If no trusted address is available, ip, family, and ipSource are null and
reason is client_ip_unavailable or pseudo_ipv4_without_ipv6.
ipSource is cf-connecting-ipv6 when restoring a Pseudo IPv4 overwrite.
In Add Header mode ipSource remains cf-connecting-ip and pseudoIpv4
contains the additional Class E address when present.
City/region information, when available, is approximate and connection-specific;
the API never exposes coordinates.
Use Content-Type: application/json and at least one of:
{ "ipv4": "8.8.8.8", "ipv6": "2001:4860:4860::8888" }Only these two optional string fields are allowed, with at most one IP per family. Bodies are limited to 1,024 actual bytes, including chunked bodies, and must arrive within five seconds. The endpoint accepts uncompressed JSON. Addresses must be canonicalizable global unicast. Private, loopback, link-local, shared/CGNAT, documentation, multicast, IPv4-mapped IPv6 and special-purpose ranges are excluded. The browser submits detected addresses. Other API clients can submit any address that passes the same checks.
The response has separate ipv4 and ipv6 slots; an unrequested slot is null.
Each requested slot contains:
{
"ip": "8.8.8.8",
"family": "ipv4",
"network": {
"status": "ok",
"source": "ipinfo",
"reason": null,
"data": {
"asn": "AS15169",
"organization": "Example organization",
"domain": "example.net",
"countryCode": "US",
"country": "United States",
"continentCode": "NA",
"continent": "North America"
}
},
"reverseDns": {
"status": "none",
"names": [],
"reason": null
}
}Values above are examples. Network statuses are ok (IPinfo), fallback
(Cloudflare for the matching observed IP), unavailable (missing token), or
error. Unavailable/error data is null; fallback data has no unsupported
IPinfo fields. DNS statuses are ok, none (NXDOMAIN/no PTR), or error.
Failure reasons include missing_token, timeout, http_error, network_error,
invalid_response, dns_error, and internal_error.
Accepted lookups return 200 even when enrichment partially fails; the explicit
per-service status explains the failure and preserves the other results. Invalid
requests return 400, cross-origin browser lookups 403, unknown endpoints 404,
incorrect methods 405 with Allow, incomplete uploads that time out 408,
oversized bodies 413, unsupported types or
encodings 415, and unexpected internal failures 500. Errors have
{"error":{"code":"...","message":"..."}}. No upstream response or secret is echoed.
IPinfo Lite does not provide city location, VPN/proxy detection, or paid features. AS organization is not necessarily the consumer-facing ISP brand. PTR records are DNS information, not verified host identity.
No GitHub Actions deployment workflow is needed. Use Cloudflare's native Workers Builds integration.
-
Prepare the zone. Add
lukasberan.czto Cloudflare and ensure the zone is Active. Keep Network → IPv6 Compatibility enabled so IPv6-only visitors can access the first-party site. Resolve any conflicting DNS record forip.lukasberan.czbefore creating its Worker Custom Domain. -
Publish the source. Commit the project files, including
package-lock.json, to the publicluberan/ip-inforepository and pushmain. Generated bundles, dependencies,.dev.vars, and environment files are ignored. -
Connect GitHub. In Cloudflare, open Workers & Pages → Create application → GitHub (not a Pages project). Authorize the Cloudflare GitHub app for this repository, select
luberan/ip-info, and configure:Setting Value Worker/project name ip-lukasberan, exactly as in WranglerProduction branch mainRoot directory Repository root ( /)Build command npm ci && npm test && npm run buildDeploy command npm run deployBuild variable NODE_VERSION=24.15.0Plan Workers Free Allow Cloudflare to generate its scoped deployment API token. Do not add account IDs or credentials to the repository. Disable preview-branch builds initially: this project deliberately disables public preview URLs and defines only its production Custom Domain.
-
Save and Deploy. The Wrangler configuration registers
ip.lukasberan.czwithcustom_domain: true. Verify it under the Worker's Settings → Domains & Routes and wait for DNS/certificate activation.workers.devis disabled; use the Custom Domain, not an automatically suggested subdomain. The initial deployment remains functional without IPinfo enrichment. -
Add the runtime secret. Register for IPinfo Lite and copy your token from the IPinfo dashboard. In Workers & Pages → ip-lukasberan → Settings → Variables & Secrets → Add, choose Secret, name it
IPINFO_TOKEN, and paste the token. Save/deploy the change. This is a Worker runtime secret, not a Builds environment variable, a plaintext Wranglervarsentry, or a browser setting. Normal Wrangler deployments preserve existing Worker secrets. -
Verify the live site. Open https://ip.lukasberan.cz, test copy/refresh, check
/api/connection, and confirmno-storeon API responses. Check both families on actual IPv4/IPv6-capable networks. Missing IPv6 alone is not proof of a disabled protocol. -
Subsequent releases. Commit and push to
main; Cloudflare installs, validates, and deploys automatically. Inspect Deployments / build history if a build fails. Keep the runtime secret out of Git and build logs.
For an existing Worker, use ip-lukasberan → Settings → Builds → Connect and
apply the same settings. The dashboard name must match wrangler.jsonc.
npm ci
npm test
npm run build
npx wrangler login
npm run deploy
npx wrangler secret put IPINFO_TOKENEnter the secret only at Wrangler's interactive prompt. The last command requires the Worker to exist; runtime secrets cannot be provisioned by committing them. You can then connect that existing Worker to Builds as described above.
The English privacy notice explains the browser's ipify requests, the Worker's IPinfo enrichment, Cloudflare DNS queries, and providers' possible processing of connection information. The application stores no visitor data in a database or persistent browser storage and does not log IP addresses. Unexpected failures have generic diagnostics with no request, token, or upstream payload logging.
Wrangler disables Workers Logs, invocation logs, tracing, and Logpush. This does not eliminate Cloudflare's infrastructure/security processing or logs operated by ipify/IPinfo/DNS providers. Do not enable Cloudflare Web Analytics, automatic tracking injections, or other nonessential scripts without updating the CSP and privacy notice.
Static responses use public/_headers; Worker responses set their own headers.
The browser CSP permits only same-origin assets/APIs and the two ipify endpoints.
No upstream strings become HTML. No URL can be supplied to the API, redirects are
not followed, upstream JSON is size-limited, and individual upstream requests
time out after 3.5 seconds. A client disconnect cancels outstanding lookups.
Static Assets are served directly. A normal dual-stack refresh uses one connection
request and one lookup per detected family (up to three Worker invocations).
A batched API lookup makes at most four parallel upstream requests, below the
Free plan's 50 subrequest and six outgoing-connection limits. The application has
no KV, D1, R2, Durable Objects, or background work. Free Workers still have a
100,000-request daily allowance and a 10 ms CPU limit; network wait time is not
CPU time. Production traffic/CPU and upstream availability must be monitored in
Cloudflare's aggregate metrics. A public API can consume its quota under abuse;
consider a zone-level rate rule for /api/lookup if needed.
Never add Cache Everything or an Edge TTL override to /api/*. Do not place
personalized API responses in a shared cache. Standard static-asset caching is
safe; it contains no rendered visitor information.
public/
index.html, 404.html, styles.css, favicon.svg, _headers
app.js Generated browser bundle (ignored by Git)
src/
index.ts Narrow Worker API router
client/
app.ts, validation.ts Vanilla UI, independent checks, response validation
lib/
ip.ts Shared strict parser and PTR name construction
connection.ts Trusted Cloudflare connection extraction
metadata.ts Shared, explicitly scoped metadata fallback
lookup.ts, dns.ts IPinfo Lite and Cloudflare DoH
http.ts, response.ts Deadlines, bounded JSON, secure API responses
types.ts, validation.ts Response contracts and validation helpers
tests/ Mocked Worker, IP, DNS, HTTP, browser, config tests
scripts/smoke*.mjs Real Workers runtime routing and lookup checks
.github/
workflows/ CI, dependency review, and Scorecard (no deployment)
dependabot.yml npm and action update PRs
SECURITY.md Private vulnerability reporting policy
wrangler.jsonc Static Assets, Custom Domain, disabled observability
tsconfig*.json Separate Worker and browser type environments
vitest.config.ts Automated test configuration
package.json, package-lock.json, .node-version
.dev.vars.example, .gitignore, LICENSE
| Symptom | Check |
|---|---|
| IPv6 cannot be verified | Try an IPv6-capable network, disable a blocker for ipify, and retry. Do not infer that IPv6 is disabled. |
| Addresses work but IPinfo does not | Verify the runtime IPINFO_TOKEN secret, the Lite plan, and upstream availability. DNS is independent. |
| PTR record not found | This is a valid DNS result, unlike a failed DNS query. Many public addresses have no PTR. |
| Local Cloudflare fields are unavailable | request.cf and client headers are incomplete locally; do not add fabricated values. |
| Browser changes are not visible | Check the custom build output in the npm run dev terminal for TypeScript bundling errors. |
| Copy fails | Use HTTPS/localhost and allow clipboard writes, or select and copy the value manually. |
| Builds reports a name mismatch | Both dashboard and Wrangler must use ip-lukasberan. |
| Builds fails on Node/dependencies | Use Node 24.15.0, commit the lockfile, and install with npm ci. |
Windows hot reload reports spawn EPERM |
Stop Wrangler and restart npm run dev; the local runtime may fail to respawn on Windows. |
| Custom Domain does not activate | Confirm the active zone, conflicting DNS records, and TLS certificate status. |
| CSP errors | Do not inject third-party scripts/fonts; only the documented ipify browser hosts are allowed. |
MIT. The bundled ipaddr.js parser is also MIT-licensed; its copyright
and permission notice are retained in the shared parser and generated bundles.