DEV Community

Eli Krizevski
Eli Krizevski

Posted on Edited on AI-assisted

How we built a "What is my ISP?" lookup that never logs your IP

"What is my ISP?" sounds like a simple question. Most tools that answer it send your IP address to a paid
lookup service, log it, or both. For a VPN comparison site, that felt wrong: a privacy tool shouldn't leak your
address to answer a question about it.

So we built our own and open-sourced it: CompareVPN Tools,
a small ASP.NET Core API that powers the ISP checker on CompareVPN. You can read every
line, or run your own copy with one Docker command.

What it answers

Ask it about an address, and you get the network that owns it:

{
  "ipAddress": "73.1.2.3",
  "ipVersion": 4,
  "isPublic": true,
  "network": {
    "asn": 7922,
    "name": "Comcast Xfinity",
    "organization": "COMCAST-7922 - Comcast Cable Communications, LLC",
    "countryCode": "US",
    "range": { "start": "73.0.0.0", "end": "73.255.255.255" },
    "isHosting": false
  },
  "dataUpdatedAt": "2026-11-04T21:46:11+00:00"
}
Enter fullscreen mode Exit fullscreen mode

There are two endpoints: GET /api/tools/isp for the caller's own address, and GET /api/tools/isp/{ip} for
any IPv4 or IPv6 address.

Privacy rules the code has to follow

We wrote these down before writing any code, and the project treats breaking one as a security bug:

  1. Lookups run against local data only. No address is ever sent to another service.
  2. Addresses are never logged or stored. Not in request logs, not in error logs.
  3. Responses are sent with Cache-Control: no-store, so no proxy or browser cache keeps a copy.

The only place an address lives, even briefly, is in memory as the key for the per-minute rate limit.

Where the data comes from

The lookup uses the free iptoasn.com dataset, which is public domain. It's one
compressed file listing every block of IP addresses on the internet and the network (ASN) that announces it.

The app reads the whole file into memory once and sorts the blocks by their first address. Finding the network
for an address is then a binary search: look at the middle block, decide whether the address comes before or
after it, and halve the list until you land on the right block. With roughly half a million blocks, that's
about 20 steps per lookup.

Swapping in fresh data without a restart

The dataset changes daily, and we didn't want a restart (or a slow moment) every time it did. So a background
service checks the file now and then. When it changes:

  1. The new file is read and sorted in full, in the background, while lookups keep using the old copy.
  2. Only when the new copy is complete is it swapped in, in one step.
  3. If the new file is missing or broken, it's ignored and the old copy keeps answering.

Lookups never wait, and never see half a file. The cost is memory: while a reload runs, both copies are in
memory for a moment.

Turning registry names into names people know

Networks are registered under names like COMCAST-7922 - Comcast Cable Communications, LLC, which isn't what
anyone calls their ISP. A small formatter tidies them:

  • it removes the registry code in front ("COMCAST-7922 - ")
  • it removes legal endings ("Inc", "LLC", "GmbH", "Co., Ltd")
  • it softens names written in capitals ("BELL MOBILITY" → "Bell Mobility")
  • it swaps in the brand customers know ("Charter Communications" is sold as Spectrum)

It's a best guess, so the raw registered name is always returned alongside as organization.

Is it a home connection or a data center?

isHosting is true for networks that belong to cloud, hosting and VPN providers. It's deliberately
conservative: true means "this is a known hosting network", but false doesn't prove an address is someone's
home connection.

Run it yourself

git clone https://github.com/elidotexe/comparevpn-tools
cd comparevpn-tools
docker build -t comparevpn-tools .
docker run -p 8080:8080 comparevpn-tools
Enter fullscreen mode Exit fullscreen mode

Then open http://localhost:8080/api/tools/isp/8.8.8.8. The image ships with a copy of the dataset, so it
answers straight away, and it downloads a fresh copy every 24 hours by itself. Every setting (rate limit,
allowed websites, trusted proxies) can be set with an environment variable, and a bad value stops the app at
startup with a message naming it, rather than failing on a visitor's request later.

Running without Docker works too: you need the .NET 10 SDK, a download script fetches the dataset, and
dotnet run starts the app.

What's next

The ISP checker is the first tool. The repository is set up so each new tool gets its own folder, settings and
tests, and reuses the same address data where it makes sense.

Questions, ideas, or a tool you'd like to see? Come say hi in
GitHub Discussions.
And if you spot a privacy
problem, please report it privately as described in the repo's security policy.

Top comments (0)