mroach / elixir-rdap

RDAP (Registration Data Access Protocol) client for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elixir RDAP Client

Tests

This is my first Elixir package/library. It's not yet complete and isn't yet intended for use. API may/will change and there are probably all kinds of problems with it. You've been warned :)

Queries RDAP (Registration Data Access Protocol) servers for network information. RDAP is the planned successor to WHOIS. RDAP is a REST-based protocol where the servers return standardised JSON, making it easier to consume than classic WHOIS.

curl rdap.arin.net/registry/ip/8.8.8.8 | jq

This library uses the IANA RDAP bootstrap data to identify which RDAP server should have the information about an IPv4 address. This prevents unnecessary follow-up queries. For example if you query ARIN for an IP in Europe, you'll then have to connect to RIPE to get the information. Not ideal.

Example usage

RDAP.lookup_ip "8.8.8.8"

%{:ok,
  %{
    ...
    "name" => "LVLT-GOGL-8-8-8"
    ...
  }
}

Installation

Not yet available in Hex

If available in Hex, the package can be installed by adding rdap to your list of dependencies in mix.exs:

def deps do
  [
    {:rdap, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/exrdap.

TODO

  • Support IPv6 addresses
  • Support custom RDAP servers
  • Cache responses by network. For example if querying a specific IP and the reply indicates the owner is a /24 block, cache the whole block so future lookups hit the cache.
  • Ignore non-routable IPs

About

RDAP (Registration Data Access Protocol) client for Elixir


Languages

Language:Elixir 99.6%Language:Makefile 0.4%