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.
Click to show internal directories.
Click to hide internal directories.