proxy

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: MIT Imports: 9 Imported by: 0

README

proxy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIP

func GetIP(url string) net.IP

GetIP ...

Types

type Information

type Information struct {
	Transparent bool
	Works       int
	Fails       int
}

Information ...

type Manager

type Manager struct {
	Proxies      []*url.URL
	LastFetch    time.Time
	ProxyRefresh time.Duration

	Fetchers       []func() ([]*url.URL, error)
	Timeout        time.Duration
	MaxConcurrency int
	Filter         float64
	URLTest        string

	GoodProxies  map[string]*http.Client
	ProxiesScore map[string]*Information
	Mtx          sync.Mutex
}

Manager ...

func NewDefaultManager

func NewDefaultManager() *Manager

NewDefaultManager ...

func (*Manager) AddBadProxy

func (m *Manager) AddBadProxy(key string)

AddBadProxy adds a proxy to the map of bat proxies

func (*Manager) AddProxy

func (m *Manager) AddProxy(key string, client *http.Client)

AddProxy adds a proxy to the map of good proxies

func (*Manager) GetProxies

func (m *Manager) GetProxies() ([]*url.URL, error)

GetProxies ...

func (*Manager) GetRandomClient

func (m *Manager) GetRandomClient() (*http.Client, string)

GetRandomClient ...

func (*Manager) GratzProxy

func (m *Manager) GratzProxy(key string)

GratzProxy congratz a proxy for working

func (*Manager) IsProxyBad

func (m *Manager) IsProxyBad(key string) bool

IsProxyBad ...

func (*Manager) RemoveProxy

func (m *Manager) RemoveProxy(key string)

RemoveProxy removes a proxy from the map of good proxies

func (*Manager) TestProxies

func (m *Manager) TestProxies() error

TestProxies will populate goodproxies with proxies passing the test

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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