iploc

module
v0.0.0-...-7a3fa1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2024 License: MIT

README

iploc

Test codecov

This is a simple IP geolocation service built with Go, HTMX, and Bootstrap. The application can look up geolocation information based on an IP address.

Features

  • Lookup geolocation information by IP address (IPv4 or IPv6).
  • Reduces CPU and RAM utilization by using a binary search algorithm on smaller chunks of a large raw data file, which has been pre-split
  • Auto downloading a database and preparing it for use, using a IP2Location Download Token
  • Returns the result as JSON or HTML based on the Accept header in the request
  • Simple web interface for entering an IP address and displaying results
  • Logging of search operations and results

Example

Search location:

curl http://localhost/search?ip=8.8.8.8 -H "Accept: application/json"

Output:

{
  "Code": "US",
  "Country": "United States of America",
  "Region": "California",
  "City": "Mountain View",
  "Latitude": "37.405992",
  "Longitude": "-122.078515",
  "ZipCode": "94043",
  "TimeZone": "-08:00"
}

See requests.http.

Acknowledgment

This site or product includes IP2Location LITE data available from https://lite.ip2location.com.

License

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

Directories

Path Synopsis
cmd
app
internal
pkg
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL