proxy

package
v0.0.0-...-a55d651 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAllProxiesDead = errors.New("all proxies are dead")

Functions

This section is empty.

Types

type Proxy

type Proxy struct {
	Type     ProxyType
	Host     string
	Port     string
	Username string
	Password string
	// contains filtered or unexported fields
}

func NewProxy

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

func (*Proxy) Address

func (p *Proxy) Address() string

func (*Proxy) IsAlive

func (p *Proxy) IsAlive() bool

func (*Proxy) MarkAlive

func (p *Proxy) MarkAlive()

func (*Proxy) MarkDead

func (p *Proxy) MarkDead()

func (*Proxy) RecordFailure

func (p *Proxy) RecordFailure()

func (*Proxy) RecordRequest

func (p *Proxy) RecordRequest(latency time.Duration)

func (*Proxy) Stats

func (p *Proxy) Stats() (requests, failures int64, avgLatency time.Duration)

func (*Proxy) String

func (p *Proxy) String() string

type ProxyType

type ProxyType int
const (
	ProxyTypeHTTP ProxyType = iota
	ProxyTypeHTTPS
	ProxyTypeSOCKS4
	ProxyTypeSOCKS5
)

func (ProxyType) String

func (t ProxyType) String() string

type RotationStrategy

type RotationStrategy int
const (
	RotationRandom RotationStrategy = iota
	RotationSequential
)

func ParseRotationStrategy

func ParseRotationStrategy(s string) RotationStrategy

func (RotationStrategy) String

func (s RotationStrategy) String() string

type Rotator

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

func NewRotator

func NewRotator(strategy RotationStrategy, skipDead bool, requestsPer int) *Rotator

func (*Rotator) AddProxy

func (r *Rotator) AddProxy(p *Proxy)

func (*Rotator) AliveCount

func (r *Rotator) AliveCount() int

func (*Rotator) Count

func (r *Rotator) Count() int

func (*Rotator) LoadFromFile

func (r *Rotator) LoadFromFile(path string) error

func (*Rotator) LoadFromStrings

func (r *Rotator) LoadFromStrings(urls []string) error

func (*Rotator) MarkDead

func (r *Rotator) MarkDead(p *Proxy)

func (*Rotator) Next

func (r *Rotator) Next() (*Proxy, error)

Jump to

Keyboard shortcuts

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