remote

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoadBalancer

type LoadBalancer interface {
	IsHealthy() bool
	ServeHTTP(rw http.ResponseWriter, req *http.Request)
}

LoadBalancer is an interface for proxying http request to remote server based on the load balance mode(round-robin or priority)

func NewLoadBalancer

func NewLoadBalancer(
	lbMode string,
	remoteServers []*url.URL,
	cacheMgr cachemanager.CacheManager,
	transportMgr transport.Interface,
	healthChecker healthchecker.HealthChecker,
	certManager interfaces.YurtCertificateManager,
	filterManager *filter.Manager,
	stopCh <-chan struct{}) (LoadBalancer, error)

NewLoadBalancer creates a loadbalancer for specified remote servers

type RemoteProxy

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

RemoteProxy is an reverse proxy for remote server

func NewRemoteProxy

func NewRemoteProxy(remoteServer *url.URL,
	cacheMgr cachemanager.CacheManager,
	transportMgr transport.Interface,
	healthChecker healthchecker.HealthChecker,
	filterManager *filter.Manager,
	stopCh <-chan struct{}) (*RemoteProxy, error)

NewRemoteProxy creates an *RemoteProxy object, and will be used by LoadBalancer

func (*RemoteProxy) IsHealthy

func (rp *RemoteProxy) IsHealthy() bool

IsHealthy returns healthy status of remote server

func (*RemoteProxy) Name

func (rp *RemoteProxy) Name() string

Name represents the address of remote server

func (*RemoteProxy) RoundTrip added in v0.6.0

func (rp *RemoteProxy) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip is used to implement http.RoundTripper for RemoteProxy.

func (*RemoteProxy) ServeHTTP

func (rp *RemoteProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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