• Your shopping cart is empty!

IP2Proxy Go Package

This package is the Go programming language package to support all IP2Proxy™ BIN database products to query proxy IP address and its country, region, city, ISP name and proxy types. It has been optimized for speed and memory utilization.

Installation
go get github.com/ip2location/ip2proxy-go
Sample Codes
package main

import (
	"fmt"
	"github.com/ip2location/ip2proxy-go"
)

func main() {
	if ip2proxy.Open("./IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.BIN") == 0 {
		ip := "199.83.103.79"

		fmt.Printf("ModuleVersion: %s\n", ip2proxy.ModuleVersion())
		fmt.Printf("PackageVersion: %s\n", ip2proxy.PackageVersion())
		fmt.Printf("DatabaseVersion: %s\n", ip2proxy.DatabaseVersion())

		// functions for individual fields
		fmt.Printf("IsProxy: %d\n", ip2proxy.IsProxy(ip))
		fmt.Printf("ProxyType: %s\n", ip2proxy.GetProxyType(ip))
		fmt.Printf("CountryShort: %s\n", ip2proxy.GetCountryShort(ip))
		fmt.Printf("CountryLong: %s\n", ip2proxy.GetCountryLong(ip))
		fmt.Printf("Region: %s\n", ip2proxy.GetRegion(ip))
		fmt.Printf("City: %s\n", ip2proxy.GetCity(ip))
		fmt.Printf("ISP: %s\n", ip2proxy.GetIsp(ip))

		// function for all fields
		all := ip2proxy.GetAll(ip)
		fmt.Printf("isProxy: %s\n", all["isProxy"])
		fmt.Printf("ProxyType: %s\n", all["ProxyType"])
		fmt.Printf("CountryShort: %s\n", all["CountryShort"])
		fmt.Printf("CountryLong: %s\n", all["CountryLong"])
		fmt.Printf("Region: %s\n", all["Region"])
		fmt.Printf("City: %s\n", all["City"])
		fmt.Printf("ISP: %s\n", all["ISP"])
	} else {
		fmt.Printf("Error reading BIN file.\n")
	}
	ip2proxy.Close()
}
Sample IP2Proxy Databases (BIN)
Sample Packages IPv4
IP2Proxy PX1 Sample BIN File Download (5.76 MB)
IP2Proxy PX2 Sample BIN File Download (6.99 MB)
IP2Proxy PX3 Sample BIN File Download (7.57 MB)
IP2Proxy PX4 Sample BIN File Download (13.95 MB)