Public IP is a JavaScript package for quickly determining a device's externally visible IP address. It provides separate functions for IPv4, IPv6, or automatic detection that prefers IPv6 and falls back to IPv4. In Node.js, the package queries multiple DNS and HTTPS services to improve reliability. Browser environments use HTTPS-based public IP services instead of DNS queries. Operations are asynchronous and can be given explicit timeouts to avoid waiting indefinitely for unavailable services. AbortSignal support lets applications cancel an active lookup when it is no longer needed. A dedicated error type distinguishes cases where the package cannot determine a public address, making it useful for diagnostics, networking tools, and environment detection.

Features

  • Automatic public IP detection
  • Dedicated IPv4 and IPv6 lookup functions
  • Multiple DNS and HTTPS lookup providers
  • Node.js and browser support
  • Timeout and AbortSignal cancellation
  • Dedicated IP-not-found error handling

Project Samples

Project Activity

See All Activity >

Categories

Internet

License

MIT License

Follow public-ip

public-ip Web Site

Other Useful Business Software
$300 Free Credits to Build on Google Cloud Icon
$300 Free Credits to Build on Google Cloud

New customers can spin up VMs, build with AI, and query data at no cost.

Put your $300 in credit toward real workloads, then keep building with free monthly usage for 20+ products. No commitment and no charge until you upgrade.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of public-ip!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Internet Software

Registered

12 hours ago