proxy

package
v0.0.0-...-c0e25a9 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 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 Proxy

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

Proxy represents a reverse proxy for load balancing algorithms.

func NewProxy

func NewProxy(name string, addr *url.URL) *Proxy

NewProxy creates a new instance of Proxy with the specified address.

func (*Proxy) GetLoading

func (p *Proxy) GetLoading() uint32

GetLoading returns the current loading of the proxy.

func (*Proxy) GetName

func (p *Proxy) GetName() string

GetName returns the name of the proxy.

func (*Proxy) IsAvailable

func (p *Proxy) IsAvailable() bool

IsAvailable returns whether the proxy origin was successfully connected at the last check time.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles the incoming HTTP request and forwards it to the underlying proxy server. It increments the load counter by 1 before forwarding the request and decrements it by the given value after the request is processed. This method is part of the Proxy struct and implements the http.Handler interface.

Parameters: - w: The http.ResponseWriter used to write the response back to the client. - r: The http.Request representing the incoming request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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