server

command
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: MIT Imports: 7 Imported by: 0

README

Using goiplookup in HTTP server

Bolt allows only one process to lock the db file. So, both populate data and ip lookup has to be done in the same process that holds the lock. Otherwise, one process will be stuck waiting for the other process, which holds the lock, to complete.

How to run this server?

$ go build .
$ ./server

Sample Output

$ curl -s "http://localhost:8085/iplookup?ip=2001:4c0:0:0:0:0:0:0&ip=49.206.13.16&ip=216.58.196.174&ip=3.91.28.69" | jq .
[
  {
    "country": "IN",
    "ip": "49.206.13.16",
    "version": "ipv4"
  },
  {
    "country": "US",
    "ip": "3.91.28.69",
    "version": "ipv4"
  },
  {
    "country": "US",
    "ip": "216.58.196.174",
    "version": "ipv4"
  },
  {
    "country": "CA",
    "ip": "2001:4c0:0:0:0:0:0:0",
    "version": "ipv6"
  }
]

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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