npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@trace-id/ip-intel

v0.1.1

Published

IP intelligence for Trace: combine local lists and databases with IP data providers (ipinfo, IPQualityScore, MaxMind, Spur and more), with timeouts and caching.

Readme

@trace-id/ip-intel

IP intelligence for Trace: country, ASN, location and Tor, VPN, proxy, datacenter, relay and blocklist flags, combined from IP data providers and local lists. The Trace server uses it through IP_PROVIDERS (settings); in your own app, pass it to @trace-id/embed.

import { createIpIntel, ipqualityscore, cdnHeaders } from '@trace-id/ip-intel';
import { createTrace } from '@trace-id/embed';

const ipIntel = createIpIntel({
  sources: [ipqualityscore({ key: process.env.IPQS_KEY! }), cdnHeaders({ countryHeader: 'cf-ipcountry' })],
  timeoutMs: 400, // one budget for all remote lookups of an IP
  cacheTtlMs: 24 * 3_600_000, // per-IP cache
  onError: (source, err) => console.warn(source, err),
});

const trace = createTrace({ storage, secret, ipIntel });

Providers

ipqualityscore, ipinfo (Core or Lite), maxmind (Insights, City or Country web service), spur, ipdata, ipapiIs, ip2locationIo, ipregistry, proxycheck, abuseipdb, ipgeolocation, ipApi, and cdnHeaders for the country header your CDN sets. Each takes its key and an optional fetch. providersFromEnv(process.env) builds them from the same variables the server reads.

Every adapter has a pure mapper (mapIpqs, mapSpur, ...) from the provider's documented JSON to Trace's fields, so you can check what a response turns into. A flag is reported only when the provider's plan returns it: absent means "not checked", never "no".

Registry, key pool and cache

REGISTRY describes every provider: its fields (which belong to a key, which to the provider, which are secret), what it can report, a note on its free plan, and a build function. The Trace dashboard draws its forms from it, and providersFromEnv is built on it. Adding a provider is an adapter in providers.ts plus one registry entry.

import { createIpIntel, descriptor, pooledSource } from '@trace-id/ip-intel';

const ipinfo = pooledSource({
  ref: 'ipinfo-1', // stable id for cache and usage
  descriptor: descriptor('ipinfo')!,
  settings: { plan: 'lite' },
  keys: [
    { id: 'a', label: 'main', values: { token: '...' }, weight: 3, dailyLimit: 1500, enabled: true },
    { id: 'b', label: 'backup', values: { token: '...' }, weight: 1, dailyLimit: null, enabled: true },
  ],
  strategy: 'weighted', // or 'failover'
  sharePercent: 100, // send only this share of addresses
  dailyLimit: null,
  onUsage: (e) => console.log(e.providerRef, e.keyId, e.outcome, e.latencyMs),
});

const intel = createIpIntel({ sources: [ipinfo], sharedCache /* optional: Redis or anything with get/set */ });

A pooled source picks a key per lookup, skips keys that are disabled, over their daily limit or cooling down (60 seconds after a 429 or 402, ten minutes after a 401 or 403), and tries the next key when a call fails. Its usage events never contain a key. The cache keeps each source's answer per address, including "nothing known"; failed calls are not cached, and private addresses are never sent. stats() reports memory hits, shared hits and provider calls.

Your own source

const mine: IpIntelSource = {
  name: 'my-reputation-api',
  remote: true, // cached and time-limited; false for in-memory sources
  async lookup(ip, { signal }) {
    const r = await fetch(`https://rep.example.com/${ip}`, { signal }).then((x) => x.json());
    return { vpn: r.vpn, proxy: r.proxy, country: r.cc };
  },
};

Guarantees

  • Never fails an identification. A provider that errors or times out leaves its fields "not checked" for that event, and the gap is not cached, so the next request tries again.
  • Only the IP is sent, and never a private or reserved address. Providers are processors of personal data: have a data processing agreement and name them in your privacy policy.
  • Merging: sources in priority order; for country, ASN and location the first that answers wins; a flag is true when any source says so.

Free data files

downloadIpData({ dir }) from @trace-id/ip-intel/download fetches the Tor Project's exit relays, the ranges AWS, Google Cloud, Oracle Cloud, DigitalOcean and Linode publish, Apple's iCloud Private Relay ranges and DB-IP Lite databases (CC BY 4.0), plus MaxMind GeoLite2 with your account. The server wraps it as npm run ip-data -w trace-server -- <dir>.