Skip to content

Add ip2geo IP geolocation provider#368

Open
bfzli wants to merge 1 commit intonchaulet:mainfrom
bfzli:add-ip2geo-provider
Open

Add ip2geo IP geolocation provider#368
bfzli wants to merge 1 commit intonchaulet:mainfrom
bfzli:add-ip2geo-provider

Conversation

@bfzli
Copy link
Copy Markdown

@bfzli bfzli commented Apr 20, 2026

Summary

  • Adds a new provider for the ip2geo IP geolocation API
  • Supports IPv4 and IPv6 address geocoding
  • Returns 30+ fields: city, country, continent, ASN, currency, flag, timezone, registered country, etc.
  • Authentication via X-Api-Key header injected into the FetchAdapter

Usage

var NodeGeocoder = require('node-geocoder');

var geocoder = NodeGeocoder({
    provider: 'ip2geo',
    apiKey: 'your-api-key'
});

geocoder.geocode('134.201.250.155').then(console.log);

Files changed

  • New: lib/geocoder/ip2geogeocoder.js — provider implementation
  • New: test/geocoder/ip2geogeocoder.test.js — unit tests
  • Modified: lib/geocoderfactory.js — register ip2geo in the factory

Test plan

  • npm test — 236/236 tests pass (all existing + new ip2geo tests)
  • Live API test with real key returns correct data
  • node -c syntax check passes

Add support for the ip2geo.dev IP geolocation API as a new geocoder
provider. Supports IPv4 and IPv6 address lookups with rich response
data including city, country, continent, ASN, currency, flag, and
timezone information.

API docs: https://ip2geo.dev/docs
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.

1 participant