IP2Proxy Go package allows users to query an IP address to determine if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.

Go Report Card

IP2Proxy Go Package

This package allows user to query an IP address if it was being used as VPN anonymizer, open proxies, web proxies, Tor exits, data center, web hosting (DCH) range, search engine robots (SES) and residential (RES). It lookup the proxy IP address from IP2Proxy BIN Data file. This data file can be downloaded at

As an alternative, this package can also call the IP2Proxy Web Service. This requires an API key. If you don't have an existing API key, you can subscribe for one at the below:

https://www.ip2location.com/web-service/ip2proxy

Installation

To install this module type the following:

go get github.com/ip2location/ip2proxy-go

QUERY USING THE BIN FILE

Methods

Below are the methods supported in this package.

Method Name Description
OpenDB Open the IP2Proxy BIN data for lookup.
Close Close and clean up the file pointer.
PackageVersion Get the package version (1 to 11 for PX1 to PX11 respectively).
ModuleVersion Get the module version.
DatabaseVersion Get the database version.
IsProxy Check whether if an IP address was a proxy. Returned value:
  • -1 : errors
  • 0 : not a proxy
  • 1 : a proxy
  • 2 : a data center IP address or search engine robot
GetAll Return the proxy information in an array.
GetProxyType Return the proxy type. Please visit IP2Location for the list of proxy types supported.
GetCountryShort Return the ISO3166-1 country code (2-digits) of the proxy.
GetCountryLong Return the ISO3166-1 country name of the proxy.
GetRegion Return the ISO3166-2 region name of the proxy. Please visit ISO3166-2 Subdivision Code for the information of ISO3166-2 supported.
GetCity Return the city name of the proxy.
GetIsp Return the ISP name of the proxy.
GetDomain Return the domain name of the proxy.
GetUsageType Return the usage type classification of the proxy. Please visit IP2Location for the list of usage types supported.
GetAsn Return the autonomous system number of the proxy.
GetAs Return the autonomous system name of the proxy.
GetLastSeen Return the number of days that the proxy was last seen.
GetThreat Return the threat type of the proxy.
GetProvider Return the provider of the proxy.

Usage

package main

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

func main() {
	db, err := ip2proxy.OpenDB("./IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN")
	
	if err != nil {
		return
	}
	ip := "199.83.103.79"
	all, err := db.GetAll(ip)
	
	if err != nil {
		fmt.Print(err)
		return
	}
	
	fmt.Printf("ModuleVersion: %s\n", ip2proxy.ModuleVersion())
	fmt.Printf("PackageVersion: %s\n", db.PackageVersion())
	fmt.Printf("DatabaseVersion: %s\n", db.DatabaseVersion())
	
	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"])
	fmt.Printf("Domain: %s\n", all["Domain"])
	fmt.Printf("UsageType: %s\n", all["UsageType"])
	fmt.Printf("ASN: %s\n", all["ASN"])
	fmt.Printf("AS: %s\n", all["AS"])
	fmt.Printf("LastSeen: %s\n", all["LastSeen"])
	fmt.Printf("Threat: %s\n", all["Threat"])
	fmt.Printf("Provider: %s\n", all["Provider"])
	
	db.Close()
}

QUERY USING THE IP2PROXY PROXY DETECTION WEB SERVICE

Methods

Below are the methods supported in this class.

Method Name Description
OpenWS(apikey string, apipackage string, usessl bool) Expects 3 input parameters:
  1. IP2Proxy API Key.
  2. Package (PX1 - PX11)
  3. Use HTTPS or HTTP
LookUp(ipAddress string) Query IP address. This method returns a struct containing the proxy info.
  • CountryCode
  • CountryName
  • RegionName
  • CityName
  • ISP
  • Domain
  • UsageType
  • ASN
  • AS
  • LastSeen
  • Threat
  • ProxyType
  • IsProxy
  • Provider
    GetCredit() This method returns the web service credit balance in a struct.
    package main
    
    import (
    	"fmt"
    	"github.com/ip2location/ip2proxy-go"
    )
    
    func main() {
    	apikey := "YOUR_API_KEY"
    	apipackage := "PX11"
    	usessl := true
    
    	ws, err := ip2proxy.OpenWS(apikey, apipackage, usessl)
    
    	if err != nil {
    		fmt.Print(err)
    		return
    	}
    	ip := "8.8.8.8"
    	res, err := ws.LookUp(ip)
    
    	if err != nil {
    		fmt.Print(err)
    		return
    	}
    
    	if res.Response != "OK" {
    		fmt.Printf("Error: %s\n", res.Response)
    	} else {
    		fmt.Printf("IsProxy: %s\n", res.IsProxy)
    		fmt.Printf("ProxyType: %s\n", res.ProxyType)
    		fmt.Printf("CountryCode: %s\n", res.CountryCode)
    		fmt.Printf("CountryName: %s\n", res.CountryName)
    		fmt.Printf("RegionName: %s\n", res.RegionName)
    		fmt.Printf("CityName: %s\n", res.CityName)
    		fmt.Printf("ISP: %s\n", res.ISP)
    		fmt.Printf("Domain: %s\n", res.Domain)
    		fmt.Printf("UsageType: %s\n", res.UsageType)
    		fmt.Printf("ASN: %s\n", res.ASN)
    		fmt.Printf("AS: %s\n", res.AS)
    		fmt.Printf("LastSeen: %s\n", res.LastSeen)
    		fmt.Printf("Threat: %s\n", res.Threat)
    		fmt.Printf("Provider: %s\n", res.Provider)
    	}
    
    	res2, err := ws.GetCredit()
    
    	if err != nil {
    		fmt.Print(err)
    		return
    	}
    	
    	fmt.Printf("Credit Balance: %s\n", res2.Response)
    }
    Owner
    IP2Location
    IP geolocation solution. Determine geographical location information such as county, city, zipcode, mobile network information by IP address.
    IP2Location
    Similar Resources

    oniongrok forwards ports on the local host to remote Onion addresses as Tor hidden services and vice-versa

    oniongrok Onion addresses for anything. oniongrok forwards ports on the local host to remote Onion addresses as Tor hidden services and vice-versa. Wh

    Jan 1, 2023

    SplitVPN - Split Internet and VPN routing

    SplitVPN - Split Internet and VPN routing

    Jul 15, 2022

    Golang Client for querying Tor network data using the Onionoo service.

    gonion Lightweight Golang wrapper for querying Tor network data using the Onionoo service. package main import ( "github.com/R4yGM/gonion"

    May 11, 2022

    Tor ready router

    DPI installing don't forget to replace the username with your username: mkdir build cd build wget https://openresty.org/download/openresty-1.19.9.1.ta

    Feb 13, 2022

    meek is a blocking-resistant pluggable transport for Tor.

    meek is a blocking-resistant pluggable transport for Tor. It encodes a data stream as a sequence of HTTPS requests and responses. Requests are reflect

    Nov 9, 2021

    Vanitytorgen - Vanity Tor keys/onion addresses generator

    Vanity Tor keys/onion addresses generator Assumptions You know what you are doing. You know where to copy the output files. You know how to set up a H

    May 12, 2022

    Proxtor - A simple tool to connect to the network using Tor

    Proxtor A simple tool to connect to the network using Tor. Installing Go to rele

    Jan 1, 2022

    Decentralized VPN in golang

    Decentralized VPN in golang

    LCVPN - Light decentralized VPN in golang Originally this repo was just an answer on a question "how much time it'll take to write my own simple VPN i

    Dec 28, 2022

    SonicWall VPN-SSL Exploit* using Golang

    SonicWall VPN-SSL Exploit* using Golang

    goshock SonicWall VPN-SSL Exploit* using Golang ( * and other targets vulnerable to shellshock ).

    Jul 6, 2022
    Comments
    • GetAll causes runtime exception

      GetAll causes runtime exception

      Hi,

      We recently upgraded our ip2proxy package version from 2.2.0 to 2.3.0, and we started to get the following exception on calling db.GetAll("8.8.8.8"):

      panic: runtime error: slice bounds out of range [:16] with capacity 12
      
      goroutine 1 [running]:
      github.com/ip2location/ip2proxy-go.(*DB).readuint32_row(0xc0001ce070, 0xc00049af10, 0xc, 0xc, 0xc, 0x0)
      	/Users/USER/go/pkg/mod/github.com/ip2location/[email protected]+incompatible/ip2proxy.go:195 +0xbf
      github.com/ip2location/ip2proxy-go.(*DB).query(0xc0001ce070, 0x177e7ea, 0x7, 0xc000000fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
      	/Users/USER/go/pkg/mod/github.com/ip2location/[email protected]+incompatible/ip2proxy.go:874 +0x10f6
      github.com/ip2location/ip2proxy-go.(*DB).GetAll(0xc0001ce070, 0x177e7ea, 0x7, 0x0, 0x0, 0x0)
      	/Users/USER/go/pkg/mod/github.com/ip2location/[email protected]+incompatible/ip2proxy.go:636 +0xb5
      ...
      

      After trying to debug it, I've found out that the exception is caused at: https://github.com/ip2location/ip2proxy-go/blob/5f6cbea4cf350ee98cac3871c5d6b4bd13f7a09c/ip2proxy.go#L871-L877 row is 12 bytes and d.readuint32_row tries to read range [12:16].

      We need this fixed to use release v2.3.0 to benefit from concurrency improvements.

    • Fix go modules

      Fix go modules

      go get github.com/ip2location/[email protected]
      go get: github.com/ip2location/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3
      

      @ip2location New releases are unusable now.

      https://golang.org/ref/mod#major-version-suffixes

    Remake of the original sqlifinder but in GOlang, and allows for listed targets, domain crawling, and tor connections
    Remake of the original sqlifinder but in GOlang, and allows for listed targets, domain crawling, and tor connections

    _______ _____ _____ _______ _____ __ _ ______ _______ ______ |______ | __| | | |______ | | \ | | \ |______ |_____/

    Jan 4, 2023
    Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.
    Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.

    Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.

    Jan 27, 2022
    A Tor package updater and runner as an I2P Plugin
    A Tor package updater and runner as an I2P Plugin

    i2p.plugins.tor-updater A Tor package updater and runner as an I2P Plugin. This plugin is still being changed rapidly but it should be usable on most

    Jul 31, 2022
    A VPN Proxy Helper

    VPN Proxy Helper Sometimes, VPN clients do not change the routing table of the computer but it still exists the VPN interface. Sometimes, you don't wa

    Aug 19, 2022
    A server that proxies requests and uses fhttp & my fork of CycleTLS to modify your clienthello and prevent your requests from being fingerprinted.

    TLS-Fingerprint-API A server that proxies requests and uses my fork of CycleTLS & fhttp (fork of net/http) to prevent your requests from being fingerp

    Jan 7, 2023
    Lightweight rest api that allows users to run Powershell commands over HTTP.

    Powershell Proxy Lightweight rest api that allows users to run Powershell commands over HTTP. Requests require a valid JWT and responses are returned

    Mar 18, 2022
    A small tool used to correspond to the IP address according to the name, id, and network alias of the docker container, which can be run as a DNS server

    A small tool used to correspond to the IP address according to the name, id, and network alias of the docker container, which can be run as a DNS server

    Apr 4, 2022
    An example go service that is being tested by nonnative.

    Nonnative Example An example go service that is being tested by nonnative. Structure The project follows the structure in golang-standards/project-lay

    Oct 31, 2021
    A Wireguard VPN Server Manager and API to add and remove clients

    Wireguard Manager And API A manager and API to add, remove clients as well as other features such as an auto reapplier which deletes and adds back a c

    Dec 22, 2022
    A lightweight and simplistic Tor library for golang

    gotor A lightweight and simplistic Tor library for golang go get github.com/ripmeep/gotor import "github.com/ripmeep/gotor" Usage t := tor.TorConnecti

    Jul 2, 2022