proxy

package
v5.1.11-release+incomp... Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextKey

type ContextKey string

ContextKey context key

type Endpoint

type Endpoint string

Endpoint Endpoint

func (Endpoint) GetAddr

func (e Endpoint) GetAddr() string

GetAddr get addr

func (Endpoint) GetHTTPAddr

func (e Endpoint) GetHTTPAddr() string

GetHTTPAddr get http url

func (Endpoint) GetName

func (e Endpoint) GetName() string

GetName get endpoint name

func (Endpoint) String

func (e Endpoint) String() string

type EndpointList

type EndpointList []Endpoint

EndpointList EndpointList

func CreateEndpoints

func CreateEndpoints(endpoints []string) EndpointList

CreateEndpoints CreateEndpoints

func (*EndpointList) Add

func (e *EndpointList) Add(endpoints ...string)

Add Add

func (*EndpointList) Delete

func (e *EndpointList) Delete(endpoints ...string)

Delete Delete

func (*EndpointList) HaveEndpoint

func (e *EndpointList) HaveEndpoint(endpoint string) bool

HaveEndpoint Whether or not there is a endpoint

func (*EndpointList) Len

func (e *EndpointList) Len() int

Len Len

func (*EndpointList) Selec

func (e *EndpointList) Selec(i int) Endpoint

Selec Selec

type HTTPProxy

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

HTTPProxy HTTPProxy

func (*HTTPProxy) Do

func (h *HTTPProxy) Do(r *http.Request) (*http.Response, error)

Do do proxy

func (*HTTPProxy) Proxy

func (h *HTTPProxy) Proxy(w http.ResponseWriter, r *http.Request)

Proxy http proxy

func (*HTTPProxy) UpdateEndpoints

func (h *HTTPProxy) UpdateEndpoints(endpoints ...string)

UpdateEndpoints 更新端点

type LoadBalance

type LoadBalance interface {
	Select(r *http.Request, endpoints EndpointList) Endpoint
}

LoadBalance LoadBalance

func NewRoundRobin

func NewRoundRobin() LoadBalance

NewRoundRobin create a RoundRobin

type Proxy

type Proxy interface {
	Proxy(w http.ResponseWriter, r *http.Request)
	Do(r *http.Request) (*http.Response, error)
	UpdateEndpoints(endpoints ...string) // format: ["name=>ip:port", ...]
}

Proxy proxy

func CreateProxy

func CreateProxy(name string, mode string, endpoints []string) Proxy

CreateProxy create proxy

type RoundRobin

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

RoundRobin round robin loadBalance impl

func (RoundRobin) Select

func (rr RoundRobin) Select(r *http.Request, endpoints EndpointList) Endpoint

Select select a server from servers using RoundRobin

type SelectBalance

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

SelectBalance 选择性负载均衡

func NewSelectBalance

func NewSelectBalance() *SelectBalance

NewSelectBalance 创建选择性负载均衡

func (*SelectBalance) Select

func (s *SelectBalance) Select(r *http.Request, endpoints EndpointList) Endpoint

Select 负载

type WebSocketProxy

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

WebSocketProxy WebSocketProxy

func (*WebSocketProxy) Do

func (h *WebSocketProxy) Do(r *http.Request) (*http.Response, error)

Do do proxy

func (*WebSocketProxy) Proxy

func (h *WebSocketProxy) Proxy(w http.ResponseWriter, req *http.Request)

Proxy websocket proxy

func (*WebSocketProxy) UpdateEndpoints

func (h *WebSocketProxy) UpdateEndpoints(endpoints ...string)

UpdateEndpoints 更新后端点

Jump to

Keyboard shortcuts

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