rainbond: github.com/goodrain/rainbond/api/proxy Index | Files

package proxy

import "github.com/goodrain/rainbond/api/proxy"

Index

Package Files

http_proxy.go lb.go proxy.go websocket_proxy.go

type ContextKey Uses

type ContextKey string

ContextKey context key

type Endpoint Uses

type Endpoint string

Endpoint Endpoint

func (Endpoint) GetAddr Uses

func (e Endpoint) GetAddr() string

GetAddr get addr

func (Endpoint) GetHTTPAddr Uses

func (e Endpoint) GetHTTPAddr() string

GetHTTPAddr get http url

func (Endpoint) GetName Uses

func (e Endpoint) GetName() string

GetName get endpoint name

func (Endpoint) String Uses

func (e Endpoint) String() string

type EndpointList Uses

type EndpointList []Endpoint

EndpointList EndpointList

func CreateEndpoints Uses

func CreateEndpoints(endpoints []string) EndpointList

CreateEndpoints CreateEndpoints

func (*EndpointList) Add Uses

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

Add Add

func (*EndpointList) Delete Uses

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

Delete Delete

func (*EndpointList) HaveEndpoint Uses

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

HaveEndpoint Whether or not there is a endpoint

func (*EndpointList) Len Uses

func (e *EndpointList) Len() int

Len Len

func (*EndpointList) Selec Uses

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

Selec Selec

type HTTPProxy Uses

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

HTTPProxy HTTPProxy

func (*HTTPProxy) Do Uses

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

Do do proxy

func (*HTTPProxy) Proxy Uses

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

Proxy http proxy

func (*HTTPProxy) UpdateEndpoints Uses

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

UpdateEndpoints 更新端点

type LoadBalance Uses

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

LoadBalance LoadBalance

func NewRoundRobin Uses

func NewRoundRobin() LoadBalance

NewRoundRobin create a RoundRobin

type Proxy Uses

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 Uses

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

CreateProxy create proxy

type RoundRobin Uses

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

RoundRobin round robin loadBalance impl

func (RoundRobin) Select Uses

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

Select select a server from servers using RoundRobin

type SelectBalance Uses

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

SelectBalance 选择性负载均衡

func NewSelectBalance Uses

func NewSelectBalance() *SelectBalance

NewSelectBalance 创建选择性负载均衡

func (*SelectBalance) Select Uses

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

Select 负载

type WebSocketProxy Uses

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

WebSocketProxy WebSocketProxy

func (*WebSocketProxy) Do Uses

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

Do do proxy

func (*WebSocketProxy) Proxy Uses

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

Proxy websocket proxy

func (*WebSocketProxy) UpdateEndpoints Uses

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

UpdateEndpoints 更新后端点

Package proxy imports 10 packages (graph) and is imported by 4 packages. Updated 2019-12-09. Refresh now. Tools for package owners.