An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# ip2proxy

IP2Location.com Proxy database parser for Golang

[![Build Status](https://travis-ci.org/etf1/ip2proxy.svg?branch=master)](https://travis-ci.org/etf1/ip2proxy)
[![Go Report Card](https://goreportcard.com/badge/github.com/etf1/ip2proxy)](https://goreportcard.com/report/github.com/etf1/ip2proxy)
[![GoDoc](https://godoc.org/github.com/etf1/ip2proxy?status.svg)](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")
}
}
```