proxypool

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package proxypool offers a proxy ranking model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitProxyPool

func InitProxyPool(urls string, test string, timeout time.Duration) (pp map[string]*ProxyPool)

InitProxyPool initializes a ProxyPool from configured URLs.

Types

type Proxy

type Proxy struct {
	Ewma *ewma.EWMA
	URL  *url.URL
	// contains filtered or unexported fields
}

Proxy stores the upstream proxy(socks/http, h3) settings.

func NewProxies

func NewProxies(urls []string) []*Proxy

NewProxies generates Proxies form URL strings.

func NewProxy

func NewProxy(s string) (*Proxy, error)

NewProxy generates a Proxy form a URL string.

func (*Proxy) Check

func (p *Proxy) Check(target *url.URL, timeout time.Duration) error

Check the avalability of a Proxy.

func (*Proxy) Dup

func (p *Proxy) Dup() *Proxy

Dup duplicates a Proxy struct.

type ProxyPool

type ProxyPool struct {
	sync.RWMutex
	Proxies       []*Proxy
	Checker       string
	ProxyProbeURL *url.URL
	Timeout       time.Duration
}

ProxyPool struct.

func (*ProxyPool) GetProxy added in v0.1.3

func (pp *ProxyPool) GetProxy(i int) (p *Proxy)

GetProxy gets a proxy by index mapping.

func (*ProxyPool) Sort added in v0.1.10

func (pp *ProxyPool) Sort()

Sort the proxies in pool.

func (*ProxyPool) Update

func (pp *ProxyPool) Update()

Update and sort the EWMA of proxies in the pool.

func (*ProxyPool) UpdateProxy added in v0.1.10

func (pp *ProxyPool) UpdateProxy(p *Proxy, d time.Duration)

UpdateProxy updates EWMA of the specified proxy.

Jump to

Keyboard shortcuts

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