proxy

package
v0.0.0-...-2cbf347 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidHostPort = errors.New("invalid proxy host/port")
View Source
var ErrInvalidPort = errors.New("Port maximum value is 65535")
View Source
var ErrInvalidType = errors.New("Invalid proxy type")

Functions

This section is empty.

Types

type GeoInfo

type GeoInfo struct {
	Continent struct {
		Code  string            `maxminddb:"code" json:"code"`
		Names map[string]string `maxminddb:"names" json:"names"`
	} `maxminddb:"continent" json:"continent"`
	Country struct {
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union" json:"is_in_european_union"`
		IsoCode           string            `maxminddb:"iso_code" json:"iso_code"`
		Names             map[string]string `maxminddb:"names" json:"names"`
	} `maxminddb:"country" json:"country"`
	Subdivisions []struct {
		IsoCode string            `maxminddb:"iso_code" json:"iso_code"`
		Names   map[string]string `maxminddb:"names" json:"names"`
	} `maxminddb:"subdivisions" json:"subdivisions"`
	City struct {
		Names map[string]string `maxminddb:"names" json:"names"`
	} `maxminddb:"city" json:"city"`
	Postal struct {
		Code string `maxminddb:"code" json:"code"`
	} `maxminddb:"postal" json:"postal"`
	Location struct {
		Latitude  float64 `maxminddb:"latitude" json:"latitude"`
		Longitude float64 `maxminddb:"longitude" json:"longitude"`
		TimeZone  string  `maxminddb:"time_zone" json:"time_zone"`
	} `maxminddb:"location" json:"location"`
}

type Proxy

type Proxy struct {
	Host    string
	Port    int
	Type    ProxyType
	IsAlive bool
	Geo     *GeoInfo
}

func FromHostPort

func FromHostPort(hostport string) (Proxy, error)

func (*Proxy) HostPortString

func (p *Proxy) HostPortString() string

func (*Proxy) Schema

func (p *Proxy) Schema() string

func (*Proxy) Transport

func (p *Proxy) Transport() (*http.Transport, error)

func (*Proxy) UrlString

func (p *Proxy) UrlString() string

type ProxyType

type ProxyType int
const (
	TypeUnknown ProxyType = iota
	TypeHTTP
	TypeHTTPS
	TypeSOCKS4
	TypeSOCKS4A
	TypeSOCKS5
)

Jump to

Keyboard shortcuts

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