Sign inSign up

whoisgray/ip-information

By whoisgray

•Updated over 3 years ago

IP-Information Capture client details: IP, user-agent, and location. lightweight Node.js

Image
1

1.6K

whoisgray/ip-information repository overview

⁠🌐 IP Information

A simple Node.js application that captures client request details and provides information about the client, including IP address, user agent, and geo location.

⁠🚀 Usage

⁠Pull the Docker Image
docker pull WhoisGray/ip-information:latest
⁠Run the Docker Container
docker run -p 3000:3000 WhoisGray/ip-information:latest

Open your browser and navigate to http://localhost:3000⁠ to access the application.

⁠🐳 Docker Compose

If you prefer to use Docker Compose, you can use the following docker-compose.yml file:

version: '3'
services:
  ip-information:
    image: whoisgray/ip-information:latest
    ports:
      - 3000:3000

Save this content in a file named docker-compose.yml in your project directory, and then run the following command:

  docker-compose up

This will start the IP Information application in a Docker container.

⁠📋 Features

  • Express⁠ - Fast, unopinionated, minimalist web framework for Node.js.
  • geoip-lite⁠ - Light-weight module to look up IP address information.

⁠Routes

The application defines the following routes:

  • Root Route ("/")

    • This route handles GET requests to the root URL ("/").
    • It retrieves the client's public IP address and sends it as a response to the client.
    • The IP address is extracted from the request headers, specifically the "x-forwarded-for" header or the remote address.
    • The IP address is displayed as a response message, indicating the client's public IP address.
  • "/details" Route

    • This route handles GET requests to the "/details" URL.
    • It retrieves additional information about the client, including IP address, user agent, and geo location.
    • The IP address is extracted from the request headers, similar to the root route.
    • The user agent information is obtained from the "user-agent" header in the request.
    • The geo location information is obtained using the "geoip-lite" package based on the client's IP address.
    • The response is a JSON object containing the client's IP address, user agent, and geo location details, along with other request information like URL, method, headers, and cookies.

You can access the root route ("/") to retrieve the client's public IP address and the "/details" route to obtain more comprehensive client information.

Feel free to modify or add more routes based on your application's requirements.

⁠📝 License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

⁠📂 Repository and Source Code

The source code for this application is available on GitHub⁠. You can find the Dockerfiles and the project files in the repository. Feel free to explore, contribute, and provide feedback.

⁠👤 Author:

Tag summary

Content type

Image

Digest

sha256:ea5c575dd…

Size

135.9 MB

Last updated

over 3 years ago

docker pull whoisgray/ip-information