gopi

command module
v0.0.0-...-a2be749 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: GPL-2.0 Imports: 6 Imported by: 0

README

gopi

Demo

Idea

This idea come from IP zxq and literaly i clone it, also already used for my project.

Download GeoIP2Lite Database

First of all, we need to download the database from Maxmind and below you can use this to download the db and remember to change YOUR_LICENSE_KEY

You can obtain LICENSE KEY here

wget -O geoip.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=YOUR_LICENSE_KEY&suffix=tar.gz"
tar -zxvf geoip.tar.gz
mv geoip.tar.gz data

Development

git clone https://github.com/troke12/gopi
cd gopi
cp .env.example .env
go build
./gopi

Docker

If you want to use docker just add some build-arg in build docker

docker build --build-arg LICENSEY_KEY=LICENSEY_KEY --build-arg API_FGIP=API_FREEGEOIP --build-arg PORT="localhost:3045" --build-arg ROLLBARTOKEN=ROLLBAR_TOKEN . -t gopi

docker run -d p 3045:3045 --name gopi gopi

It will automatically download the latest MaxMindDB and extract it to the data folder

Routes

  • / - get your current information
  • /8.8.8.8/country - get the country iso code
  • /8.8.8.8 - get the information another ip

Result

{
    "ip":"127.0.0.1",
    "city":"Jakarta",
    "region":"Jakarta",
    "country":"ID",
    "country_full":"Indonesia",
    "continent":"AS",
    "continent_full":"Asia",
    "loc":"-6.2092,106.8200",
    "postal":""
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
models
web

Jump to

Keyboard shortcuts

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