https://github.com/fegoa89/ipapi
Golang API wrapper that finds the location of an IP address using ipapi.co.
https://github.com/fegoa89/ipapi
golang ipapi
Last synced: 9 months ago
JSON representation
Golang API wrapper that finds the location of an IP address using ipapi.co.
- Host: GitHub
- URL: https://github.com/fegoa89/ipapi
- Owner: fegoa89
- License: mit
- Created: 2019-02-13T08:26:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T10:07:16.000Z (over 4 years ago)
- Last Synced: 2025-02-15T04:19:11.872Z (11 months ago)
- Topics: golang, ipapi
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://semaphoreci.com/fegoa89/ipapi)[](https://godoc.org/github.com/fegoa89/ipapi)
# IPAPI
Golang API wrapper that finds the location of an IP address using ipapi.co.
If you purchased a paid plan, export the API Key in the environment:
```shell
export IPAPI_KEY=123456asdqwe
```
### FindLocation
Returns the complete location information for an IP address specified in the function parameter.
```golang
ipapi.FindLocation("178.13.214.11")
```
### ClientLocation
Returns the complete location of the client (device) that’s making the request. You do not need to specify the IP address, it is inferred from the request.
```golang
ipapi.ClientLocation()
```
### Usage
```golang
package main
import (
"fmt"
"github.com/fegoa89/ipapi"
)
func main() {
// Location of a specific IP
ipapi.FindLocation("178.13.214.11")
// Location of client's IP
ipapi.ClientLocation()
}
```