Documentation ¶
Index ¶
- Constants
- Variables
- func NewLoggingHandler(h http.Handler) http.Handler
- func Run(port, sock, configFilename string)
- type Callback
- type Config
- type Message
- type Path
- type Proxy
- type Receiver
- type Session
- type SessionPool
- type Stats
- func (s *Stats) ClosedEvent()
- func (s *Stats) ClosingConnections() int64
- func (s *Stats) ClosingEvent()
- func (s *Stats) ConnectErrorEvent()
- func (s *Stats) ConnectErrors() int64
- func (s *Stats) ConnectEvent()
- func (s *Stats) Connections() int64
- func (s *Stats) DisconnectEvent()
- func (s *Stats) Dump(w io.Writer) error
- func (s *Stats) DumpText(w io.Writer) error
- func (s *Stats) MessageErrorEvent()
- func (s *Stats) MessageErrors() int64
- func (s *Stats) MessageEvent()
- func (s *Stats) TotalConnections() int64
- func (s *Stats) TotalMessages() int64
- type WebSocketServer
- func (s *WebSocketServer) ConnectCallbackHandler(w http.ResponseWriter, r *http.Request) (*http.Response, error)
- func (s *WebSocketServer) Handler(w http.ResponseWriter, r *http.Request)
- func (s *WebSocketServer) NewWebSocketHandler(resp *http.Response) (func(ws *websocket.Conn), error)
- func (s *WebSocketServer) NewWebSocketSession(key string, ws *websocket.Conn) (*WebSocketSession, error)
- func (s *WebSocketServer) Register()
- func (s *WebSocketServer) Shutdown(ctx context.Context) error
- func (s *WebSocketServer) StatsHandler(w http.ResponseWriter, r *http.Request)
- type WebSocketSession
Constants ¶
View Source
const ( DefaultPort = "9180" DefaultOriginPolicy = "none" )
View Source
const ( ENDPOINT_HEADER_NAME = "X-Kuiperbelt-Endpoint" CALLBACK_CLIENT_MAX_CONNS_PER_HOST = 32 )
Variables ¶
View Source
var ( Version string Log *zap.Logger )
Functions ¶
Types ¶
type Config ¶
type Config struct { Callback Callback `yaml:"callback"` SessionHeader string `yaml:"session_header"` Port string `yaml:"port"` Sock string `yaml:"sock"` Endpoint string `yaml:"endpoint"` StrictBroadcast bool `yaml:"strict_broadcast"` ProxySetHeader map[string]string `yaml:"proxy_set_header"` SendTimeout time.Duration `yaml:"send_timeout"` SendQueueSize int `yaml:"send_queue_size"` OriginPolicy string `yaml:"origin_policy"` IdleTimeout time.Duration `yaml:"idle_timeout"` SuppressAccessLog bool `yaml:"suppress_access_log"` Path Path `yaml:"path"` }
type Proxy ¶
type Proxy struct { Config Config Stats *Stats Pool *SessionPool }
func (*Proxy) CloseHandlerFunc ¶
func (p *Proxy) CloseHandlerFunc(w http.ResponseWriter, r *http.Request)
CloseHandlerFunc handles POST /close request.
func (*Proxy) PingHandlerFunc ¶
func (p *Proxy) PingHandlerFunc(w http.ResponseWriter, r *http.Request)
PingHandlerFunc handles ping request.
func (*Proxy) SendHandlerFunc ¶
func (p *Proxy) SendHandlerFunc(w http.ResponseWriter, r *http.Request)
SendHandlerFunc handles POST /send request.
type Session ¶
type Session interface { Send() chan<- Message Key() string Close() error Closed() <-chan struct{} }
Session is an interface for sessions.
type SessionPool ¶ added in v1.1.0
type SessionPool struct {
// contains filtered or unexported fields
}
SessionPool is a pool of sessions.
func (*SessionPool) Add ¶ added in v1.1.0
func (p *SessionPool) Add(s Session)
Add add new session into the SessionPool.
func (*SessionPool) Delete ¶ added in v1.1.0
func (p *SessionPool) Delete(key string) error
Delete deletes a session.
func (*SessionPool) Get ¶ added in v1.1.0
func (p *SessionPool) Get(key string) (Session, error)
Get gets a session from the SessionPool.
func (*SessionPool) List ¶ added in v1.1.0
func (p *SessionPool) List() []Session
List returns a slice of all sessions in the pool.
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
func (*Stats) ClosedEvent ¶ added in v1.1.0
func (s *Stats) ClosedEvent()
func (*Stats) ClosingConnections ¶ added in v1.1.0
func (*Stats) ClosingEvent ¶ added in v1.1.0
func (s *Stats) ClosingEvent()
func (*Stats) ConnectErrorEvent ¶
func (s *Stats) ConnectErrorEvent()
func (*Stats) ConnectErrors ¶
func (*Stats) ConnectEvent ¶
func (s *Stats) ConnectEvent()
func (*Stats) Connections ¶
func (*Stats) DisconnectEvent ¶
func (s *Stats) DisconnectEvent()
func (*Stats) MessageErrorEvent ¶
func (s *Stats) MessageErrorEvent()
func (*Stats) MessageErrors ¶
func (*Stats) MessageEvent ¶
func (s *Stats) MessageEvent()
func (*Stats) TotalConnections ¶
func (*Stats) TotalMessages ¶
type WebSocketServer ¶
type WebSocketServer struct { Config Config Stats *Stats Pool *SessionPool // contains filtered or unexported fields }
func NewWebSocketServer ¶
func NewWebSocketServer(c Config, s *Stats, p *SessionPool) *WebSocketServer
func (*WebSocketServer) ConnectCallbackHandler ¶
func (s *WebSocketServer) ConnectCallbackHandler(w http.ResponseWriter, r *http.Request) (*http.Response, error)
func (*WebSocketServer) Handler ¶
func (s *WebSocketServer) Handler(w http.ResponseWriter, r *http.Request)
Handler handles websocket connection requests.
func (*WebSocketServer) NewWebSocketHandler ¶
func (*WebSocketServer) NewWebSocketSession ¶
func (s *WebSocketServer) NewWebSocketSession(key string, ws *websocket.Conn) (*WebSocketSession, error)
func (*WebSocketServer) Register ¶
func (s *WebSocketServer) Register()
func (*WebSocketServer) Shutdown ¶ added in v1.1.0
func (s *WebSocketServer) Shutdown(ctx context.Context) error
func (*WebSocketServer) StatsHandler ¶
func (s *WebSocketServer) StatsHandler(w http.ResponseWriter, r *http.Request)
type WebSocketSession ¶
type WebSocketSession struct {
// contains filtered or unexported fields
}
func (*WebSocketSession) Closed ¶ added in v1.1.0
func (s *WebSocketSession) Closed() <-chan struct{}
func (*WebSocketSession) Send ¶ added in v1.1.0
func (s *WebSocketSession) Send() chan<- Message
Send returns the channel for sending messages.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.