ip2proxy

package module
v4.0.0-...-b262ab3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 17 Imported by: 0

README

Go Report Card PkgGoDev

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), residential proxies (RES), consumer privacy networks (CPN), and enterprise private networks (EPN). It lookup the proxy IP address from IP2Proxy BIN Data file. This data file can be downloaded at

Developer Documentation

To learn more about installation, usage, and code examples, please visit the developer documentation at https://ip2proxy-go.readthedocs.io/en/latest/index.html.

Documentation

Overview

Package ip2proxy 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), residential (RES), consumer privacy networks (CPN) and enterprise private networks (EPN) by using the IP2Proxy database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HMqrDMKj

func HMqrDMKj() error

func ModuleVersion

func ModuleVersion() string

ModuleVersion returns the version of the component.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

The DB struct is the main object used to query the IP2Proxy BIN file.

func OpenDB

func OpenDB(dbPath string) (*DB, error)

OpenDB takes the path to the IP2Proxy BIN database file. It will read all the metadata required to be able to extract the embedded proxy data, and return the underlining DB object.

func OpenDBWithReader

func OpenDBWithReader(reader dbReader) (*DB, error)

OpenDBWithReader takes a dbReader to the IP2Proxy BIN database file. It will read all the metadata required to be able to extract the embedded proxy data, and return the underlining DB object.

func (*DB) Close

func (d *DB) Close() error

Close is used to close file descriptor.

func (*DB) DatabaseVersion

func (d *DB) DatabaseVersion() string

DatabaseVersion returns the database version.

func (*DB) GetAll

func (d *DB) GetAll(ipAddress string) (IP2ProxyRecord, error)

GetAll will return all proxy fields based on the queried IP address.

func (*DB) GetAs

func (d *DB) GetAs(ipAddress string) (string, error)

GetAs will return the autonomous system name based on the queried IP address.

func (*DB) GetAsn

func (d *DB) GetAsn(ipAddress string) (string, error)

GetAsn will return the autonomous system number based on the queried IP address.

func (*DB) GetCity

func (d *DB) GetCity(ipAddress string) (string, error)

GetCity will return the city name based on the queried IP address.

func (*DB) GetCountryLong

func (d *DB) GetCountryLong(ipAddress string) (string, error)

GetCountryLong will return the country name based on the queried IP address.

func (*DB) GetCountryShort

func (d *DB) GetCountryShort(ipAddress string) (string, error)

GetCountryShort will return the ISO-3166 country code based on the queried IP address.

func (*DB) GetDomain

func (d *DB) GetDomain(ipAddress string) (string, error)

GetDomain will return the domain name based on the queried IP address.

func (*DB) GetFraudScore

func (d *DB) GetFraudScore(ipAddress string) (string, error)

GetFraudScore will return the fraud score of the queried IP address.

func (*DB) GetIsp

func (d *DB) GetIsp(ipAddress string) (string, error)

GetIsp will return the Internet Service Provider name based on the queried IP address.

func (*DB) GetLastSeen

func (d *DB) GetLastSeen(ipAddress string) (string, error)

GetLastSeen will return the number of days that the proxy was last seen based on the queried IP address.

func (*DB) GetProvider

func (d *DB) GetProvider(ipAddress string) (string, error)

GetProvider will return the provider of the proxy.

func (*DB) GetProxyType

func (d *DB) GetProxyType(ipAddress string) (string, error)

GetProxyType will return the proxy type based on the queried IP address.

func (*DB) GetRegion

func (d *DB) GetRegion(ipAddress string) (string, error)

GetRegion will return the region name based on the queried IP address.

func (*DB) GetThreat

func (d *DB) GetThreat(ipAddress string) (string, error)

GetThreat will return the threat type of the proxy.

func (*DB) GetUsageType

func (d *DB) GetUsageType(ipAddress string) (string, error)

GetUsageType will return the usage type based on the queried IP address.

func (*DB) IsProxy

func (d *DB) IsProxy(ipAddress string) (int8, error)

IsProxy checks whether the queried 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).

func (*DB) PackageVersion

func (d *DB) PackageVersion() string

PackageVersion returns the database type.

type IP2ProxyCreditResult

type IP2ProxyCreditResult struct {
	Response string `json:"response"`
}

The IP2ProxyCreditResult struct stores the credit balance for the IP2Proxy Web Service.

type IP2ProxyRecord

type IP2ProxyRecord struct {
	CountryShort string
	CountryLong  string
	Region       string
	City         string
	Isp          string
	ProxyType    string
	Domain       string
	UsageType    string
	Asn          string
	As           string
	LastSeen     string
	Threat       string
	Provider     string
	FraudScore   string
	IsProxy      int8
}

The IP2ProxyRecord struct stores all of the available proxy info found in the IP2Proxy database.

type IP2ProxyResult

type IP2ProxyResult struct {
	Response    string `json:"response"`
	CountryCode string `json:"countryCode"`
	CountryName string `json:"countryName"`
	RegionName  string `json:"regionName"`
	CityName    string `json:"cityName"`
	ISP         string `json:"isp"`
	Domain      string `json:"domain"`
	UsageType   string `json:"usageType"`
	ASN         string `json:"asn"`
	AS          string `json:"as"`
	LastSeen    string `json:"lastSeen"`
	ProxyType   string `json:"proxyType"`
	Threat      string `json:"threat"`
	IsProxy     string `json:"isProxy"`
	Provider    string `json:"provider"`
}

The IP2ProxyResult struct stores all of the available proxy info found in the IP2Proxy Web Service.

type WS

type WS struct {
	// contains filtered or unexported fields
}

The WS struct is the main object used to query the IP2Proxy Web Service.

func OpenWS

func OpenWS(apikey string, apipackage string, usessl bool) (*WS, error)

OpenWS initializes with the web service API key, API package and whether to use SSL

func (*WS) GetCredit

func (w *WS) GetCredit() (IP2ProxyCreditResult, error)

GetCredit will return the web service credit balance.

func (*WS) LookUp

func (w *WS) LookUp(ipAddress string) (IP2ProxyResult, error)

LookUp will return all proxy fields based on the queried IP address.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL