Skip to content
/ ip Public

whatismyipaddress.com in just a few lines of code

License

Notifications You must be signed in to change notification settings

wajeht/ip

Repository files navigation

🌎 Ip

Node.js CI License: MIT Open Source Love svg1

whatismyipaddress.com in just a few lines of code.

If the IP address was found, the lookup method returns an object with the following structure:

// https://ip.jaw.dev/?geo=true
// https://ip.jaw.dev/?geo=true&json=true
{
   ip: '127.0.0.1',               // ip address
   range: [420, 69],              // <low bound of IP block>, <high bound of IP block>
   country: 'XX',                 // 2 letter ISO-3166-1 country code
   region: 'RR',                  // Up to 3 alphanumeric variable length characters as ISO 3166-2 code
                                  // For US states this is the 2 letter state
                                  // For the United Kingdom this could be ENG as a country like “England
                                  // FIPS 10-4 subcountry code
   eu: '0',                       // 1 if the country is a member state of the European Union, 0 otherwise.
   timezone: 'Country/Zone',      // Timezone from IANA Time Zone Database
   city: "City Name",             // This is the full city name
   ll: [420, 69],                 // The latitude and longitude of the city
   metro: 420,                    // Metro code
   area: 69                       // The approximate accuracy radius (km), around the latitude and longitude
}

💻 Development

Note

Nodejs version of this project is also available via git checkout node after pulling it down.

Clone the repository

$ git clone https://github.com/wajeht/ip.git

Copy .env.example to .env

$ cp .env.example .env

Install dependencies

$ go install

Run development server

$ go run .

Test the application

$ go test

📜 License

Distributed under the MIT License © wajeht. See LICENSE for more information.

About

whatismyipaddress.com in just a few lines of code

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published