Documentation ¶
Index ¶
- Constants
- type ConnectCredentials
- type ConnectHandler
- type ConnectHandlerConfig
- type ConnectProxy
- type ConnectReply
- type ConnectRequest
- type ConnectRequestHTTP
- type HTTPCaller
- type HTTPConnectProxy
- type HTTPRPCProxy
- type HTTPRefreshProxy
- type Option
- type Options
- type RPCData
- type RPCHandler
- type RPCHandlerConfig
- type RPCProxy
- type RPCReply
- type RPCRequest
- type RPCRequestHTTP
- type RefreshCredentials
- type RefreshHandler
- type RefreshHandlerConfig
- type RefreshProxy
- type RefreshReply
- type RefreshRequest
- type RefreshRequestHTTP
Constants ¶
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 ¶
func (h *ConnectHandler) Handle(node *centrifuge.Node) func(ctx context.Context, t centrifuge.TransportInfo, e centrifuge.ConnectEvent) centrifuge.ConnectReply
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 ¶
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) 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) 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) 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 ¶
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 (*RPCHandler) Handle ¶
func (h *RPCHandler) Handle(ctx context.Context, node *centrifuge.Node, client *centrifuge.Client) func(e centrifuge.RPCEvent) centrifuge.RPCReply
Handle RPC.
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 ¶
func (h *RefreshHandler) Handle(node *centrifuge.Node) func(context.Context, *centrifuge.Client, centrifuge.RefreshEvent) centrifuge.RefreshReply
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 ...