Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 10 days 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 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T10:07:16.000Z (about 3 years ago)
- Last Synced: 2023-07-28T18:22:44.033Z (over 1 year 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
[![Build Status](https://semaphoreci.com/api/v1/fegoa89/ipapi/branches/master/badge.svg)](https://semaphoreci.com/fegoa89/ipapi)[![GoDoc](https://godoc.org/github.com/fegoa89/ipapi?status.svg)](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 mainimport (
"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()
}
```