proxy

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxIdleConnsPerHost = 255

DefaultMaxIdleConnsPerHost is a reasonable value for all HTTP clients.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectCredentials

type ConnectCredentials struct {
	UserID     string          `json:"user"`
	ExpireAt   int64           `json:"expire_at"`
	Info       json.RawMessage `json:"info"`
	Base64Info string          `json:"b64info"`
	Data       json.RawMessage `json:"data"`
	Base64Data string          `json:"b64data"`
	Channels   []string        `json:"channels"`
}

ConnectCredentials ...

type ConnectHandler

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

ConnectHandler ...

func NewConnectHandler

func NewConnectHandler(c ConnectHandlerConfig) *ConnectHandler

NewConnectHandler ...

func (*ConnectHandler) Handle

Handle returns connecting handler func.

type ConnectHandlerConfig

type ConnectHandlerConfig struct {
	Proxy ConnectProxy
}

ConnectHandlerConfig ...

type ConnectProxy

type ConnectProxy interface {
	ProxyConnect(context.Context, ConnectRequest) (*ConnectReply, error)
	// Protocol for metrics and logging.
	Protocol() string
}

ConnectProxy allows to proxy connect requests to application backend to authenticate client connection.

type ConnectReply

type ConnectReply struct {
	Result     *ConnectCredentials    `json:"result"`
	Error      *centrifuge.Error      `json:"error"`
	Disconnect *centrifuge.Disconnect `json:"disconnect"`
}

ConnectReply ...

type ConnectRequest

type ConnectRequest struct {
	ClientID  string
	Transport centrifuge.TransportInfo
	Data      centrifuge.Raw
}

ConnectRequest ...

type ConnectRequestHTTP

type ConnectRequestHTTP struct {
	Data json.RawMessage `json:"data,omitempty"`
	// Base64Data to proxy protobuf data.
	Base64Data string `json:"b64data,omitempty"`
	// contains filtered or unexported fields
}

ConnectRequestHTTP ...

type HTTPCaller

type HTTPCaller interface {
	CallHTTP(context.Context, http.Header, []byte) ([]byte, error)
}

HTTPCaller is responsible for calling HTTP.

func NewHTTPCaller

func NewHTTPCaller(endpoint string, httpClient *http.Client) HTTPCaller

NewHTTPCaller creates new HTTPCaller.

type HTTPConnectProxy

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

HTTPConnectProxy ...

func NewHTTPConnectProxy

func NewHTTPConnectProxy(endpoint string, httpClient *http.Client, opts ...Option) *HTTPConnectProxy

NewHTTPConnectProxy ...

func (*HTTPConnectProxy) Protocol

func (p *HTTPConnectProxy) Protocol() string

Protocol ...

func (*HTTPConnectProxy) ProxyConnect

func (p *HTTPConnectProxy) ProxyConnect(ctx context.Context, req ConnectRequest) (*ConnectReply, error)

ProxyConnect proxies connect control to application backend.

type HTTPRPCProxy

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

HTTPRPCProxy ...

func NewHTTPRPCProxy

func NewHTTPRPCProxy(endpoint string, httpClient *http.Client, opts ...Option) *HTTPRPCProxy

NewHTTPRPCProxy ...

func (*HTTPRPCProxy) Protocol

func (p *HTTPRPCProxy) Protocol() string

Protocol ...

func (*HTTPRPCProxy) ProxyRPC

func (p *HTTPRPCProxy) ProxyRPC(ctx context.Context, req RPCRequest) (*RPCReply, error)

ProxyRPC ...

type HTTPRefreshProxy

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

HTTPRefreshProxy ...

func NewHTTPRefreshProxy

func NewHTTPRefreshProxy(endpoint string, httpClient *http.Client, opts ...Option) *HTTPRefreshProxy

NewHTTPRefreshProxy ...

func (*HTTPRefreshProxy) Protocol

func (p *HTTPRefreshProxy) Protocol() string

Protocol ...

func (*HTTPRefreshProxy) ProxyRefresh

func (p *HTTPRefreshProxy) ProxyRefresh(ctx context.Context, req RefreshRequest) (*RefreshReply, error)

ProxyRefresh proxies refresh to application backend.

type Option

type Option func(*Options)

Option is a type to represent various options.

func WithExtraHeaders

func WithExtraHeaders(headers []string) Option

WithExtraHeaders allows to set ExtraHeaders.

type Options

type Options struct {
	// ExtraHeaders is a slice of custom headers from original HTTP request to add to proxy request.
	ExtraHeaders []string
}

Options define some options to alter behaviour of proxy.

type RPCData

type RPCData struct {
	Data       json.RawMessage `json:"data"`
	Base64Data string          `json:"b64data"`
}

RPCData ...

type RPCHandler

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

RPCHandler ...

func NewRPCHandler

func NewRPCHandler(c RPCHandlerConfig) *RPCHandler

NewRPCHandler ...

func (*RPCHandler) Handle

Handle RPC.

type RPCHandlerConfig

type RPCHandlerConfig struct {
	Proxy RPCProxy
}

RPCHandlerConfig ...

type RPCProxy

type RPCProxy interface {
	ProxyRPC(context.Context, RPCRequest) (*RPCReply, error)
	// Protocol for metrics and logging.
	Protocol() string
}

RPCProxy allows to proxy RPC requests to application backend.

type RPCReply

type RPCReply struct {
	Result     *RPCData               `json:"result"`
	Error      *centrifuge.Error      `json:"error"`
	Disconnect *centrifuge.Disconnect `json:"disconnect"`
}

RPCReply ...

type RPCRequest

type RPCRequest struct {
	Data      centrifuge.Raw
	ClientID  string
	UserID    string
	Transport centrifuge.TransportInfo
}

RPCRequest ...

type RPCRequestHTTP

type RPCRequestHTTP struct {
	UserID string          `json:"user"`
	Data   json.RawMessage `json:"data,omitempty"`
	// Base64Data to proxy binary data.
	Base64Data string `json:"b64data,omitempty"`
	// contains filtered or unexported fields
}

RPCRequestHTTP ...

type RefreshCredentials

type RefreshCredentials struct {
	Expired    bool            `json:"expired"`
	ExpireAt   int64           `json:"expire_at"`
	Info       json.RawMessage `json:"info"`
	Base64Info string          `json:"b64info"`
}

RefreshCredentials ...

type RefreshHandler

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

RefreshHandler ...

func NewRefreshHandler

func NewRefreshHandler(c RefreshHandlerConfig) *RefreshHandler

NewRefreshHandler ...

func (*RefreshHandler) Handle

Handle refresh.

type RefreshHandlerConfig

type RefreshHandlerConfig struct {
	Proxy RefreshProxy
}

RefreshHandlerConfig ...

type RefreshProxy

type RefreshProxy interface {
	ProxyRefresh(context.Context, RefreshRequest) (*RefreshReply, error)
	// Protocol for metrics and logging.
	Protocol() string
}

RefreshProxy allows to send refresh requests.

type RefreshReply

type RefreshReply struct {
	Result     *RefreshCredentials    `json:"result"`
	Error      *centrifuge.Error      `json:"error"`
	Disconnect *centrifuge.Disconnect `json:"disconnect"`
}

RefreshReply ...

type RefreshRequest

type RefreshRequest struct {
	ClientID  string
	UserID    string
	Transport centrifuge.TransportInfo
}

RefreshRequest ...

type RefreshRequestHTTP

type RefreshRequestHTTP struct {
	UserID string `json:"user"`
	// contains filtered or unexported fields
}

RefreshRequestHTTP ...

Jump to

Keyboard shortcuts

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