Documentation ¶
Index ¶
- Constants
- Variables
- type ConcurrentMultiplexer
- type Connection
- func (c *Connection) Conn(conn *websocket.Conn) *websocket.Conn
- func (c *Connection) Connect()
- func (c *Connection) ConnectChan() chan bool
- func (c *Connection) ConnectOnce(timeout uint) error
- func (c *Connection) Disconnect() error
- func (c *Connection) Recv(data interface{}, timeout uint) error
- func (c *Connection) RecvBytes(timeout uint) ([]byte, error)
- func (c *Connection) RecvChan() chan []byte
- func (c *Connection) RecvErrorChan() chan Error
- func (c *Connection) Send(data interface{}, timeout uint) error
- func (c *Connection) SendBytes(bytes []byte, timeout uint) error
- func (c *Connection) SendChan() chan []byte
- func (c *Connection) SendErrorChan() chan Error
- func (c *Connection) Start()
- func (c *Connection) Stop()
- type Connector
- type ConnectorFactory
- type Error
- type Multiplexer
- type Processor
- type ProcessorFactory
Constants ¶
View Source
const (
BUFSIZE = 10
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ConcurrentMultiplexer ¶
type ConcurrentMultiplexer struct {
// contains filtered or unexported fields
}
func NewConcurrentMultiplexer ¶
func NewConcurrentMultiplexer(name string, conn Connector, commProc Processor, concurrency uint) *ConcurrentMultiplexer
func (*ConcurrentMultiplexer) Done ¶
func (m *ConcurrentMultiplexer) Done() chan bool
func (*ConcurrentMultiplexer) Send ¶
func (m *ConcurrentMultiplexer) Send(data interface{}) (interface{}, error)
func (*ConcurrentMultiplexer) Start ¶
func (m *ConcurrentMultiplexer) Start() error
func (*ConcurrentMultiplexer) Stop ¶
func (m *ConcurrentMultiplexer) Stop()
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func ExistingConnection ¶
func ExistingConnection(url, origin string, conn *websocket.Conn) *Connection
func NewConnection ¶
func NewConnection(url, origin string, headers map[string]string) *Connection
func (*Connection) Connect ¶
func (c *Connection) Connect()
func (*Connection) ConnectChan ¶
func (c *Connection) ConnectChan() chan bool
func (*Connection) ConnectOnce ¶
func (c *Connection) ConnectOnce(timeout uint) error
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect() error
func (*Connection) Recv ¶
func (c *Connection) Recv(data interface{}, timeout uint) error
func (*Connection) RecvChan ¶
func (c *Connection) RecvChan() chan []byte
func (*Connection) RecvErrorChan ¶
func (c *Connection) RecvErrorChan() chan Error
func (*Connection) Send ¶
func (c *Connection) Send(data interface{}, timeout uint) error
func (*Connection) SendChan ¶
func (c *Connection) SendChan() chan []byte
func (*Connection) SendErrorChan ¶
func (c *Connection) SendErrorChan() chan Error
func (*Connection) Start ¶
func (c *Connection) Start()
func (*Connection) Stop ¶
func (c *Connection) Stop()
type Connector ¶
type Connector interface { Start() Stop() Connect() ConnectOnce(timeout uint) error ConnectChan() chan bool Disconnect() error Send(data interface{}, timeout uint) error Recv(data interface{}, timeout uint) error SendBytes(bytes []byte, timeout uint) error RecvBytes(timeout uint) ([]byte, error) SendChan() chan []byte RecvChan() chan []byte SendErrorChan() chan Error RecvErrorChan() chan Error Conn(conn *websocket.Conn) *websocket.Conn }
type ConnectorFactory ¶
type Multiplexer ¶
type Processor ¶
type Processor interface { BeforeSend(interface{}) (id string, bytes []byte, err error) AfterRecv([]byte) (id string, data interface{}, err error) Timeout(id string) }
A Processor lets the API see and react to messages as they're sent and received. For agent communicators, we update oN tables for certain commands. For example, when a tool is stopped, we set oN.agent_config.running=false. For API communicators, we handle requests from the remote API. For example, a remote API routes an agent status request to us because we have the agent. A comm processor is also responsible for uniquely identifying messages and serializing them to []byte for sending and receiving.
type ProcessorFactory ¶
type ProcessorFactory interface {
Make() Processor
}
Click to show internal directories.
Click to hide internal directories.