ip-ptr

Get the PTR name for a given IPv4 or IPv6 address

Usage no npm install needed!

<script type="module">
  import ipPtr from 'https://cdn.skypack.dev/ip-ptr';
</script>

README

ip-ptr

Get the PTR name for a given IPv4 or IPv6 address

Installation

$ npm i ip-ptr

Example

const ipPtr = require('ip-ptr');

ipPtr('1.2.3.4');
//=> 4.3.2.1.in-addr.arpa
ipPtr('2001:db8::1');
//=> 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa

API

ipPtr(ip)

  • ip string - A IPv4 or IPv6 address.

Will throw on if ip is not a valid IP address.

© silverwind, distributed under BSD licence