Documentation
¶
Index ¶
- Variables
- type ConnMaster
- func (cm *ConnMaster) AddConn(conn net.Conn)
- func (cm *ConnMaster) AddServerConn(key string, serverConn *ssh.ServerConn)
- func (cm *ConnMaster) Callbacks(channel string) []func(string) error
- func (cm ConnMaster) ConnKey(conn net.Conn) string
- func (cm *ConnMaster) ConnKeys() []string
- func (cm *ConnMaster) Conns() map[string]*ConnMasterConn
- func (cm *ConnMaster) HandleConn(conn net.Conn) error
- func (cm *ConnMaster) OnRead(channel, payload string)
- func (cm *ConnMaster) RegisterReadCallback(channel, key string, cb func(string) error)
- func (cm *ConnMaster) RemoveConn(key string)
- func (cm *ConnMaster) ServerConfig() *ssh.ServerConfig
- type ConnMasterConn
- type WsConnMaster
- func (wsCm *WsConnMaster) AddWsConn(wsConn *websocket.Conn)
- func (wsCm *WsConnMaster) HandleWsConn(wsConn *websocket.Conn) error
- func (wsCm *WsConnMaster) OnList() *WsMsg
- func (wsCm *WsConnMaster) OnSub(key, channel string, wsConn *websocket.Conn) *WsMsg
- func (wsCm *WsConnMaster) PingPongHandler(data string) error
- func (wsCm *WsConnMaster) RemoveWsConn(key string)
- func (wsCm WsConnMaster) WsConnKey(wsConn *websocket.Conn) string
- func (wsCm *WsConnMaster) WsHandler(w http.ResponseWriter, r *http.Request)
- type WsMsg
Constants ¶
This section is empty.
Variables ¶
var ErrNilServerConfig = fmt.Errorf("Nil server config")
ErrNilServerConfig is returned when a ConnMaster has no server config.
var Upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, }
Upgrader is a struct that contains ws protocol upgrade configuration.
Functions ¶
This section is empty.
Types ¶
type ConnMaster ¶
ConnMaster is used to manage a set of net.Conn and ssh.ServerConn connections.
func NewConnMaster ¶
func NewConnMaster(serverConfig *ssh.ServerConfig) *ConnMaster
NewConnMaster returns a *ConnMaster.
func (*ConnMaster) AddConn ¶
func (cm *ConnMaster) AddConn(conn net.Conn)
func (*ConnMaster) AddServerConn ¶
func (cm *ConnMaster) AddServerConn( key string, serverConn *ssh.ServerConn, )
func (ConnMaster) ConnKey ¶
func (cm ConnMaster) ConnKey(conn net.Conn) string
ConnKey returns a string that is use for keeping track of the conn.
func (*ConnMaster) ConnKeys ¶
func (cm *ConnMaster) ConnKeys() []string
Conns returns the map of active connections.
func (*ConnMaster) Conns ¶
func (cm *ConnMaster) Conns() map[string]*ConnMasterConn
Conns returns the map of active connections.
func (*ConnMaster) HandleConn ¶
func (cm *ConnMaster) HandleConn(conn net.Conn) error
func (*ConnMaster) OnRead ¶
func (cm *ConnMaster) OnRead(channel, payload string)
func (*ConnMaster) RegisterReadCallback ¶
func (cm *ConnMaster) RegisterReadCallback(channel, key string, cb func(string) error)
func (*ConnMaster) RemoveConn ¶
func (cm *ConnMaster) RemoveConn(key string)
func (*ConnMaster) ServerConfig ¶
func (cm *ConnMaster) ServerConfig() *ssh.ServerConfig
type ConnMasterConn ¶
type ConnMasterConn struct {
// contains filtered or unexported fields
}
ConnMasterConn is an struct used to store the net.Conn and ssh.ServerConn for a connection.
type WsConnMaster ¶
WsConnMaster is used to manage a set of websocket.Conns
func NewWsConnMaster ¶
func NewWsConnMaster(cm *ConnMaster) *WsConnMaster
NewWsConnMaster returns a *WsConnMaster
func (*WsConnMaster) AddWsConn ¶
func (wsCm *WsConnMaster) AddWsConn(wsConn *websocket.Conn)
AddWsConn adds a *websocket.Conn to the WsConnMaster.
func (*WsConnMaster) HandleWsConn ¶
func (wsCm *WsConnMaster) HandleWsConn(wsConn *websocket.Conn) error
HandleWsConn handles the *websocket.Conn
func (*WsConnMaster) OnList ¶
func (wsCm *WsConnMaster) OnList() *WsMsg
func (*WsConnMaster) OnSub ¶
func (wsCm *WsConnMaster) OnSub( key, channel string, wsConn *websocket.Conn, ) *WsMsg
func (*WsConnMaster) PingPongHandler ¶
func (wsCm *WsConnMaster) PingPongHandler(data string) error
PingPongHandler is a noop response handler for websocket connections.
func (*WsConnMaster) RemoveWsConn ¶
func (wsCm *WsConnMaster) RemoveWsConn(key string)
RemoveWsConn removes a connection from the WsConnMaster.
func (WsConnMaster) WsConnKey ¶
func (wsCm WsConnMaster) WsConnKey(wsConn *websocket.Conn) string
WsConnKey returns the key for the *websocket.Conn
func (*WsConnMaster) WsHandler ¶
func (wsCm *WsConnMaster) WsHandler(w http.ResponseWriter, r *http.Request)