ipmapjs

1.0.2 • Public • Published

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

Command Input Description Expected output
getGeolocation A string ("123.6.225.1") or an array of strings (["123.6.225.1", "12.6.22.1"]) for a more efficient querying It returns the geolocation of the provided IPs If 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"
isAnycast A string ("123.6.225.1") or an array of strings (["123.6.225.1", "12.6.22.1"]) for a more efficient querying It 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"
getIXPs None Returns a list of IXPs An array of IXPs from PeeringDB and other sources
getIXP The integer ID of an IXP It returns information about an IXP An object
getFacilities None An array of facilities from PeeringDB and other source
getFacility The integer ID of a facility An object
getIXPsPeeringWithASN The integer ASn An array of IXPs where ASN is peering
getIXPFromIP An IP address (string) If the IP belongs to a peering lan of an IXP, the related IXP object will be returned
getIXPFromIPs An array of IP addresses (strings) As above, but for multiple IPs. The output is a dictionary IP to IXP.
getASNsPeeringWithIXP An integer ID of an IXP An array of ASes peering with such an IXP
getASNsHostedInFacility An integer ID of a facility An array of ASes peering with such a facility
getFacilitiesHostingASN An integer ASn An array of facilities where the AS is peering

Package Sidebar

Install

npm i ipmapjs

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

8.57 kB

Total Files

3

Last publish

Collaborators

  • maxcam