Documentation ¶
Index ¶
- Constants
- Variables
- func Dial(cfg *NetConfig) (sarif.Connection, error)
- func NewClientFactory(cfg NetConfig) sarif.ClientFactory
- func SetDefaultLogger(l Logger)
- func Subscribe(action, device string) sarif.Message
- func Transmit(a, b Conn) error
- type AuthType
- type Broker
- func (b *Broker) AuthenticateAndListenOnConn(auth AuthType, c Conn) error
- func (b *Broker) Listen(cfg *NetConfig) error
- func (b *Broker) ListenOnBridge(conn Conn) error
- func (b *Broker) ListenOnConn(conn Conn) error
- func (b *Broker) ListenOnGateway(conn Conn) error
- func (b *Broker) NewClient(ci sarif.ClientInfo) (sarif.Client, error)
- func (b *Broker) NewLocalConn() Conn
- func (b *Broker) PrintSubtree(w io.Writer) error
- func (b *Broker) SetDuplicateDepth(depth int)
- func (b *Broker) SetLogger(log Logger)
- func (b *Broker) TraceMessages(enabled bool)
- type Conn
- type Logger
- type NetConfig
- type NetListener
Constants ¶
const DefaultKeepalive = 30 * time.Second
const DefaultPort = "23100"
const DefaultTlsPort = "23443"
Variables ¶
var (
ErrClosed = errors.New("The other end is closed.")
)
Functions ¶
func NewClientFactory ¶
func NewClientFactory(cfg NetConfig) sarif.ClientFactory
func SetDefaultLogger ¶
func SetDefaultLogger(l Logger)
Types ¶
type Broker ¶
type Broker struct { Log Logger // contains filtered or unexported fields }
Broker dispatches messages to connections based on their subscriptions.
func (*Broker) AuthenticateAndListenOnConn ¶
func (*Broker) Listen ¶
Listen starts accepting connections on the specified network and blocks until an error is received.
func (*Broker) ListenOnBridge ¶
ListenOnBridge forms a bridge between two brokers by transmitting all messages in both directions, regardless of subscriptions. The call blocks until an error is received.
func (*Broker) ListenOnConn ¶
ListenOnConn starts listening on the connection for incoming messages and sends outgoing messages based on its subscriptions. The call blocks until an error is received, for example when the connection is closed.
func (*Broker) ListenOnGateway ¶
ListenOnGateway forms a client-server-relationship between two brokers by transmitting all local messages to the gateway, but receiving only subscribed messages in return.
func (*Broker) NewLocalConn ¶
NewLocalConn creates a new local connection and starts listening on it.
func (*Broker) SetDuplicateDepth ¶
SetDuplicateDepth sets the number of stored messages to check for duplicates. A zero value disables duplicate checking.
func (*Broker) TraceMessages ¶
TraceMessages enables debug output of individual messages
type Conn ¶
func NewByteConn ¶
func NewByteConn(conn io.ReadWriteCloser) Conn
type Logger ¶
type Logger interface { Debugln(v ...interface{}) Infoln(v ...interface{}) Warnln(v ...interface{}) Errorln(v ...interface{}) Fatalln(v ...interface{}) Debugf(format string, v ...interface{}) Infof(format string, v ...interface{}) Warnf(format string, v ...interface{}) Errorf(format string, v ...interface{}) Fatalf(format string, v ...interface{}) }
type NetListener ¶
func Listen ¶
func Listen(cfg *NetConfig) (*NetListener, error)
func (*NetListener) Accept ¶
func (l *NetListener) Accept() (Conn, error)