proxy

package
v0.0.0-...-9c02708 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles proxy rotation and temporary banning.

func NewManager

func NewManager(proxyURLs []string, strategy Strategy, banTime time.Duration) (*Manager, error)

NewManager creates a new proxy manager.

func (*Manager) GetProxy

func (m *Manager) GetProxy() (*url.URL, error)

GetProxy selects a proxy based on the configured strategy.

func (*Manager) ReportFailure

func (m *Manager) ReportFailure(proxy *url.URL)

ReportFailure marks a proxy as failed and bans it for the configured duration.

func (*Manager) ReportSuccess

func (m *Manager) ReportSuccess(proxy *url.URL)

ReportSuccess marks a proxy as successful.

type ProxyStat

type ProxyStat struct {
	Success  int
	Failure  int
	LastUsed time.Time
}

ProxyStat holds statistics for a single proxy.

type Strategy

type Strategy string

Strategy defines the proxy rotation strategy.

const (
	Sequential Strategy = "sequential"
	Random     Strategy = "random"
	Smart      Strategy = "smart" // Not yet implemented, defaults to random
)

Jump to

Keyboard shortcuts

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