Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmitriiweb/go-ip-country
An offline tool to get country by IP
https://github.com/dmitriiweb/go-ip-country
go golang ip ipv4
Last synced: 3 days ago
JSON representation
An offline tool to get country by IP
- Host: GitHub
- URL: https://github.com/dmitriiweb/go-ip-country
- Owner: dmitriiweb
- License: mit
- Created: 2019-08-19T20:09:20.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-19T20:15:10.000Z (about 5 years ago)
- Last Synced: 2024-06-20T02:04:00.652Z (5 months ago)
- Topics: go, golang, ip, ipv4
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ip-country
An offline tool to get country by IP## Requirements
- IP2Location™ LITE IP-COUNTRY-REGION-CITY Database## Installation
1. Download IP2Location database for IPv4 from [https://lite.ip2location.com/database/ip-country-region-city](here)
2. Install:
```
go get https://github.com/dmitriiweb/go-ip-country
```
## Usage
```
package mainimport (
"fmt"
"github.com/dmitriiweb/ip_country"
)func main() {
path := "/home/di/Downloads/ips.csv"
ips := []string{"5.34.169.32", "4.69.200.225"}res := ipCountry.GetIPData(ips, path)
for _, row := range res {
fmt.Printf("IP: %s\nCountry: %s\nCity: %s\n\n", row.IP, row.CountryName, row.CityName)
}
}
```