proxy

package module
v0.0.0-...-a9d2207 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidTransport = errors.New("invalid transport")

Functions

This section is empty.

Types

type ProxyMiddleware

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

ProxyMiddleware manages proxy rotation for HTTP requests.

func New

func New(proxies []*url.URL) *ProxyMiddleware

New creates a new ProxyMiddleware instance.

func (*ProxyMiddleware) GetProxyCount

func (m *ProxyMiddleware) GetProxyCount() int

GetProxyCount returns the current number of proxies in the list.

func (*ProxyMiddleware) Process

func (m *ProxyMiddleware) Process(ctx context.Context, httpClient *http.Client, req *http.Request, next middleware.NextFunc) (*http.Response, error)

Process applies proxy logic before passing the request to the next middleware.

func (*ProxyMiddleware) SetLogger

func (m *ProxyMiddleware) SetLogger(l logger.Logger)

SetLogger sets the logger for the middleware.

func (*ProxyMiddleware) Shuffle

func (m *ProxyMiddleware) Shuffle()

Shuffle randomizes the order of the proxies.

func (*ProxyMiddleware) UpdateProxies

func (m *ProxyMiddleware) UpdateProxies(newProxies []*url.URL)

UpdateProxies updates the list of proxies at runtime.

type SkipProxyKey

type SkipProxyKey struct{}

Jump to

Keyboard shortcuts

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