1.0.2 • Published 3 years ago

ipmapjs v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

IPmap.js

IPmap.js is a utility for interacting with the RIPE IPmap service offered by RIPE NCC. With this library you can ask for the geolocation of an IP, verify if an IP is part of an IXP peering lan, and more. The library is developed in JS and can be used both on Node.js or in the browser.

Geolocation format

The geolocation format provided by RIPE IPmap is:

{
    "score": 126,
    "geofeed": "1.2.3.4,NL,NL-07,Amsterdam,",
    "countryCodeAlpha3": "NLD",
    "countryCodeAlpha2": "NL",
    "cityPopulation": 741636,
    "stateAnsiCode": "07",
    "pointGeometry": "0101000020E61000001E5036E50A8F134087DC0C37E02F4A40",
    "cityNameAscii": "Amsterdam",
    "stateIsoCode": "NL-07",
    "countryName": "Netherlands",
    "stateName": "North Holland",
    "longitude": 4.88969,
    "geonameId": 2759794,
    "latitude": 52.37403,
    "cityName": "Amsterdam",
    "type": "city",
    "id": "AMSTERDAM-NL-07-U173ZQ2SF4C47GPE4JPJ"
}

Quick Guide

CommandInputDescriptionExpected output
getGeolocationA string ("123.6.225.1") or an array of strings ("123.6.225.1", "12.6.22.1") for a more efficient queryingIt returns the geolocation of the provided IPsIf you provide a string, you will get the location. If you provide an array, you will get back a dictionary of <IP, location> pairs. If RIPE IPmap doesn't have a geolocation for a given IP, or if the IP is anycast, the output for that IP will be "null"
isAnycastA string ("123.6.225.1") or an array of strings ("123.6.225.1", "12.6.22.1") for a more efficient queryingIt returns a boolean (or null) for each of the provided IPs, each of which identifying if the IP is anycast or not.If you provide a string, you will get a single boolean. If you provide an array, you will get back a dictionary of <IP, boolean> pairs. If RIPE IPmap doesn't have an answer for a given IP, the value for that IP will be "null"
getIXPsNoneReturns a list of IXPsAn array of IXPs from PeeringDB and other sources
getIXPThe integer ID of an IXPIt returns information about an IXPAn object
getFacilitiesNoneAn array of facilities from PeeringDB and other source
getFacilityThe integer ID of a facilityAn object
getIXPsPeeringWithASNThe integer ASnAn array of IXPs where ASN is peering
getIXPFromIPAn IP address (string)If the IP belongs to a peering lan of an IXP, the related IXP object will be returned
getIXPFromIPsAn array of IP addresses (strings)As above, but for multiple IPs. The output is a dictionary IP to IXP.
getASNsPeeringWithIXPAn integer ID of an IXPAn array of ASes peering with such an IXP
getASNsHostedInFacilityAn integer ID of a facilityAn array of ASes peering with such a facility
getFacilitiesHostingASNAn integer ASnAn array of facilities where the AS is peering