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

@apilayer/ipstack

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apilayer/ipstack

ipstack offers one of the leading IP to geolocation APIs and global IP database services worldwide.

  • 0.1.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

ipstack-go

ipstack offers one of the leading IP to geolocation APIs and global IP database services worldwide.

Installation

Using npm

npm install --save @apilayer/ipstack

or yarn

yarn add @apilayer/ipstack

Getting Started

Head over to Ipstack and create an account. Copy access key from dashboard.

import Ipstack from '@apilayer/ipstack'

const useHTTPs = false
const layer = new Ipstack("<your-access-key", useHTTPs)

setLanguage

setLanguage sets a global response language. Use the code of one of the supported languages

Signature:

setLanguage(lang: Language)

Example:

layer.setLanguage("en")

enableSecurity

enableSecurity allows for return of security data

Signature:

enableSecurity()

Example:

layer.enableSecurity()

enableHostname

enableHostname icludes hostname information in response

Signature:

enableHostname()

Example:

layer.enableHostname()

lookup

lookup returns information based on IP address

Signature:

lookup(ip: string)

Example:

layer.lookup("134.201.250.155")

Response:

{
  ip: "134.201.250.155",
  hostname: "134.201.250.155",
  type: "ipv4",
  continent_code: "NA",
  continent_name: "North America",
  country_code: "US",
  country_name: "United States",
  region_code: "CA",
  region_name: "California",
  city: "Los Angeles",
  zip: "90013",
  latitude: 34.0453,
  longitude: -118.2413,
  location: {
    geoname_id: 5368361,
    capital: "Washington D.C.",
    languages: [
      {
        code: "en",
        name: "English",
        native: "English"
      }
    ],
    country_flag: "https://assets.ipstack.com/images/assets/flags_svg/us.svg",
    country_flag_emoji: "🇺🇸",
    country_flag_emoji_unicode: "U+1F1FA U+1F1F8",
    calling_code: "1",
    is_eu: false
  },
  time_zone: {
    id: "America/LosAngeles",
    current_time: "2018-03-29T07:35:08-07:00",
    gmt_offset: -25200,
    code: "PDT",
    is_daylight_saving: true
  },
  currency: {
    code: "USD",
    name: "US Dollar",
    plural: "US dollars",
    symbol: "$",
    symbol_native: "$"
  },
  connection: {
    asn: 25876,
    isp: "Los Angeles Department of Water & Power"
  },
  security: {
    is_proxy: false,
    proxy_type: null,
    is_crawler: false,
    crawler_name: null,
    crawler_type: null,
    is_tor: false,
    threat_level: "low",
    threat_types: null
  }
}

bulkLookup

bulkLookup return information of multiple IP addresses

Signature:

bulkLookup(ips: string[])

Example:

layer.bulkLookup(["134.201.250.155"])

Response:

[{
  ip: "134.201.250.155",
  hostname: "134.201.250.155",
  type: "ipv4",
  continent_code: "NA",
  continent_name: "North America",
  country_code: "US",
  country_name: "United States",
  region_code: "CA",
  region_name: "California",
  city: "Los Angeles",
  zip: "90013",
  latitude: 34.0453,
  longitude: -118.2413,
  location: {
    geoname_id: 5368361,
    capital: "Washington D.C.",
    languages: [
      {
        code: "en",
        name: "English",
        native: "English"
      }
    ],
    country_flag: "https://assets.ipstack.com/images/assets/flags_svg/us.svg",
    country_flag_emoji: "🇺🇸",
    country_flag_emoji_unicode: "U+1F1FA U+1F1F8",
    calling_code: "1",
    is_eu: false
  },
  time_zone: {
    id: "America/LosAngeles",
    current_time: "2018-03-29T07:35:08-07:00",
    gmt_offset: -25200,
    code: "PDT",
    is_daylight_saving: true
  },
  currency: {
    code: "USD",
    name: "US Dollar",
    plural: "US dollars",
    symbol: "$",
    symbol_native: "$"
  },
  connection: {
    asn: 25876,
    isp: "Los Angeles Department of Water & Power"
  },
  security: {
    is_proxy: false,
    proxy_type: null,
    is_crawler: false,
    crawler_name: null,
    crawler_type: null,
    is_tor: false,
    threat_level: "low",
    threat_types: null
  }
}]

check

check autodetects the IP address and returns gathered information

Signature:

check()

Example:

layer.check()

Response:

{
  ip: "134.201.250.155",
  hostname: "134.201.250.155",
  type: "ipv4",
  continent_code: "NA",
  continent_name: "North America",
  country_code: "US",
  country_name: "United States",
  region_code: "CA",
  region_name: "California",
  city: "Los Angeles",
  zip: "90013",
  latitude: 34.0453,
  longitude: -118.2413,
  location: {
    geoname_id: 5368361,
    capital: "Washington D.C.",
    languages: [
      {
        code: "en",
        name: "English",
        native: "English"
      }
    ],
    country_flag: "https://assets.ipstack.com/images/assets/flags_svg/us.svg",
    country_flag_emoji: "🇺🇸",
    country_flag_emoji_unicode: "U+1F1FA U+1F1F8",
    calling_code: "1",
    is_eu: false
  },
  time_zone: {
    id: "America/LosAngeles",
    current_time: "2018-03-29T07:35:08-07:00",
    gmt_offset: -25200,
    code: "PDT",
    is_daylight_saving: true
  },
  currency: {
    code: "USD",
    name: "US Dollar",
    plural: "US dollars",
    symbol: "$",
    symbol_native: "$"
  },
  connection: {
    asn: 25876,
    isp: "Los Angeles Department of Water & Power"
  },
  security: {
    is_proxy: false,
    proxy_type: null,
    is_crawler: false,
    crawler_name: null,
    crawler_type: null,
    is_tor: false,
    threat_level: "low",
    threat_types: null
  }
}

Supported Languages

languages return all supported response languages

Example:

layer.languages()
CodeName
"en""English/US"
"de""German"
"es""Spanish"
"fr""French"
"ja""Japanese"
"pt-br""Portugues (Brazil)"
"ru""Russian"
"zh""Chinese"

License

MIT

FAQs

Package last updated on 01 Oct 2019

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