https://github.com/etf1/ip2proxy
IP2Location.com Proxy database parser for Golang
https://github.com/etf1/ip2proxy
golang golang-library golang-package iplocation proxy security tor
Last synced: 5 months ago
JSON representation
IP2Location.com Proxy database parser for Golang
- Host: GitHub
- URL: https://github.com/etf1/ip2proxy
- Owner: etf1
- License: mit
- Created: 2018-02-10T13:14:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T08:45:38.000Z (over 8 years ago)
- Last Synced: 2025-08-14T04:55:04.264Z (11 months ago)
- Topics: golang, golang-library, golang-package, iplocation, proxy, security, tor
- Language: Go
- Size: 8.52 MB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ip2proxy
IP2Location.com Proxy database parser for Golang
[](https://travis-ci.org/etf1/ip2proxy)
[](https://goreportcard.com/report/github.com/etf1/ip2proxy)
[](https://godoc.org/github.com/etf1/ip2proxy)
## Install & prerequisites
* Get the library:
```sh
go get -u github.com/etf1/ip2proxy
```
* Pick the database you need : https://www.ip2location.com/proxy-database
(You can try with a free demo database (lite) : https://lite.ip2location.com/)
* Save it unzipped to a directory readable by your Golang project
## Use it
```go
package main
import (
"github.com/etf1/ip2proxy"
)
// let's go !
func main() {
db, err := ip2proxy.Open("/where/you/unzipped/IP2PROXY-LITE-PX4.BIN")
if err != nil {
panic(err)
}
res, err := db.LookupIPV4Dot("2.7.154.188")
if err != nil {
panic(err)
}
if res.Proxy == ip2proxy.ProxyTOR {
println("2.7.154.188 is a TOR output node !")
} else {
println("2.7.154.188 is NOT a TOR output node")
}
}
```