roverse

package
v0.0.0-...-eefbc77 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RotationKeyPrefix is the prefix for roverse proxy rotation keys in Redis.
	RotationKeyPrefix = "roverse_proxy_rotation"
	// UnhealthyKeyPrefix is the prefix for storing unhealthy roverse proxy status.
	UnhealthyKeyPrefix = "roverse_proxy_unhealthy"
	// AuthHeaderName is the name of the authentication header for roverse.
	AuthHeaderName = "X-Proxy-Secret"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

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

Middleware manages Roverse proxy routing and utilizes multiple proxies from different countries.

func New

func New(
	proxies []*url.URL, client rueidis.Client, cfg *config.CommonConfig, requestTimeout time.Duration,
) *Middleware

New creates a new Roverse middleware instance.

func (*Middleware) Cleanup

func (m *Middleware) Cleanup()

Cleanup closes idle connections in the transport pool.

func (*Middleware) GetProxies

func (m *Middleware) GetProxies() []*url.URL

GetProxies returns the list of Roverse proxies.

func (*Middleware) Process

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

Process applies Roverse proxy logic and causes a temporary error if it fails.

func (*Middleware) SetLogger

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

SetLogger sets the logger for the middleware.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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