Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

public-address

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

public-address

Resolve public IP address and hostname

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-19.94%
Maintainers
1
Weekly downloads
 
Created
Source

public-address

Resolve the public IP address and hostname of your current machine.

This module makes a HTTP request to https://www.ipify.org/ IP resolving service.

Installation

npm install public-address

Usage

var publicAddress = require("public-address");
publicAddress([options,] callback);

Where

  • options - an optional options object. Everything in this object is passed to the HTTP request object (eg. agent, localAddress etc.)
  • callback - function to run once the resolving succeeded or failed. Has error object and response data as arguments

The data argument for callback has the following properties

  • address - public IP address
  • hostname - (if available) hostname of the IP address

Example

Resolve public IP:

publicAddress(function(err, data){
    console.log(err || data);
});

Example response:

{
    "address": "193.152.61.139",
    "hostname": "gprs-inet-61-139.example.com"
}

License

MIT

FAQs

Package last updated on 24 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc