Skip to content

reply2future/ip-svr

Repository files navigation

Check ip location

Build environment

  1. golang
  2. docker
  3. docker-compose
  4. mmdb

How to run

The root of project directory to execute the command.

docker-compose up -d

Usage

Request

  1. GET(query):
http://localhost:9999/search?ip=127.0.0.1,131.2.1.1,47.128.1.3
  1. POST(body):
{"ip": ["123.4.5.1", "181.4.5.2"]}

Response

{"statusCode": 1, "data": [{"ip":"123.4.5.1", "isoCode": "US", "country": "United States"}], "msg": ""}

Benchmark

cpu RAM request count elapsed time(ms)
i3-7100 3.90GHz x 2 8GB 100 32ms
i3-7100 3.90GHz x 2 8GB 200 57ms
i3-7100 3.90GHz x 2 8GB 300 88ms
i3-7100 3.90GHz x 2 8GB 400 42ms
i3-7100 3.90GHz x 2 8GB 500 132ms
i3-7100 3.90GHz x 2 8GB 1000 148ms

TODO

  • auto update mmdb per month.

Reference

  1. ip database model
  2. ip mmdb