ip-ptr

May 20, 2026 · View on GitHub

Get the PTR name for a given IPv4 or IPv6 address

Installation

$ npm i ip-ptr

Example

import ipPtr from "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 if ip is not a valid IP address.

© silverwind, distributed under BSD licence