NetworkCatsandClaude Opus 5.5 8c8b4051fb Speed up the /json API
Cache the serialized /json fields per MMDB record. Every field except
`ip` depends only on the record, and many IPs share one record, so the
response is now the cached fields with the address prepended. The cache
is keyed by data-section offset, capped at 16 MiB, and owned by the
loaded database so a hot-swapped DB never serves stale entries. A hit
costs ~0.27us instead of ~2.5us for decode + serialize; a miss is no
slower than before thanks to a pre-sized serialization buffer.

Trim per-request framework overhead shared by all endpoints:
- Dispatch by Host with a plain HostRouter service instead of an outer
  Router wrapping a service_fn, skipping a second route match and box.
- Apply security headers via tower's MapResponseLayer instead of
  middleware::from_fn, and reserve header capacity up front.
- Add a RequestedIp extractor that reads headers in place instead of
  cloning the whole HeaderMap.

On a 1 CPU / 1 GB Alpine (musl) container, /json throughput rose from
76.5k to 123.5k rps for a single IP (+61%) and from 84.9k to 130.5k rps
across 20k random IPs (+54%); p50 latency fell from 0.85ms to 0.52ms.
Responses are byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:55:38 +08:00
2026-10-22 20:55:38 +08:00
2026-10-22 20:55:38 +08:00
2026-03-07 20:34:39 +08:00
2026-10-22 20:55:38 +08:00
2026-10-22 20:55:38 +08:00
2026-03-07 20:33:43 +08:00
2026-03-04 05:18:55 +08:00
2026-03-16 11:42:08 +08:00

RustyIP

CI CodeQL codecov

Live demo: ip.nc.gy

What

RustyIP is a lightweight IP lookup service with both a web interface and an API. The frontend is minimal and works without JavaScript. The backend is written in Rust and handles high traffic reliably.

This is the only free IP lookup service with accurate proxy detection. We maintain our own exclusive proxy detection database, which is free and open source: https://github.com/NetworkCats/OpenProxyDB

We also improve geolocation coverage by merging multiple free geolocation databases into one. That's open source too: https://github.com/NetworkCats/Merged-IP-Data

RustyIP uses the best open source IP data available, delivers a clean user experience, and has zero ads or tracking.

Why

There are plenty of IP lookup sites and APIs out there, but most of them rely on the free GeoLite2 database and don't include any proxy information. On top of that, they're bloated with JavaScript and ads.

Since we already had OpenProxyDB, an accurate proxy detection database, it made sense to build a site where users can easily look up IP info. So we did.

We've privately benchmarked OpenProxyDB against commercial databases like IPinfo, and the accuracy holds up. It even outperforms them when it comes to detecting residential proxies. If you have an IPinfo or MaxMind API subscription, feel free to run your own tests.

How

You can use curl, HTTPie, wget, or any HTTP client. Here are some curl examples:

Get your current IP:

curl ip.nc.gy

Look up info about your own IP:

curl ip.nc.gy/asn

curl ip.nc.gy/org

curl ip.nc.gy/country

curl ip.nc.gy/city

curl ip.nc.gy/proxy

curl ip.nc.gy/vpn

curl ip.nc.gy/hosting

curl ip.nc.gy/tor

Or get everything as JSON:

curl ip.nc.gy/json
{
  "ip": "203.0.113.42",
  "city": {
    "geoname_id": 5128581,
    "names": {
      "en": "New York"
    }
  },
  "continent": {
    "code": "NA",
    "geoname_id": 6255149,
    "names": {
      "en": "North America"
    }
  },
  "country": {
    "geoname_id": 6252001,
    "iso_code": "US",
    "names": {
      "en": "United States"
    }
  },
  "location": {
    "accuracy_radius": 1000,
    "latitude": 40.7128,
    "longitude": -74.006,
    "metro_code": 501,
    "time_zone": "America/New_York"
  },
  "postal": {
    "code": "10001"
  },
  "subdivisions": [
    {
      "geoname_id": 5128638,
      "iso_code": "NY",
      "names": {
        "en": "New York"
      }
    }
  ],
  "asn": {
    "autonomous_system_number": 13335,
    "autonomous_system_organization": "Cloudflare, Inc.",
    "as_domain": "cloudflare.com"
  },
  "proxy": {
    "is_proxy": false,
    "is_vpn": false,
    "is_tor": false,
    "is_hosting": false,
    "is_cdn": false,
    "is_school": false,
    "is_anonymous": false
  }
}

Look up a specific IP:

curl ip.nc.gy/json?ip=1.1.1.1
{
  "ip": "1.1.1.1",
  "continent": {
    "code": "OC",
    "geoname_id": 6255151,
    "names": {
      "en": "Oceania"
    }
  },
  "country": {
    "geoname_id": 2077456,
    "iso_code": "AU",
    "names": {
      "en": "Australia"
    }
  },
  "location": {
    "accuracy_radius": 1000,
    "latitude": -33.494,
    "longitude": 143.2104,
    "time_zone": "Australia/Sydney"
  },
  "asn": {
    "autonomous_system_number": 13335,
    "autonomous_system_organization": "Cloudflare, Inc.",
    "as_domain": "cloudflare.com"
  },
  "proxy": {
    "is_proxy": false,
    "is_vpn": false,
    "is_tor": false,
    "is_hosting": false,
    "is_cdn": true,
    "is_school": false,
    "is_anonymous": false
  }
}

Use curl -4 or curl -6 to force IPv4 or IPv6.

See openapi.json in this repo for the full API spec.

Data Sources

Geolocation data is sourced from MaxMind and DB-IP free databases. AS data comes from IPinfo's free database. Proxy data comes from our own OpenProxyDB.

Attributions:

S
Description
Lightweight IP lookup service with geolocation, ASN, and proxy/VPN detection
Readme AGPL-3.0
740 KiB
Languages
Rust 74.6%
HTML 8%
CSS 5.8%
JavaScript 5.3%
Jinja 4.2%
Other 2.1%