Documentation ¶
Overview ¶
Package zmqutil - various comm ZMq routines shared be all commands
Index ¶
- Constants
- func CloseClients(clients []*Client)
- func MakeKeyPair(publicKeyFileName string, privateKeyFileName string) error
- func NewBind(log *logger.L, socketType zmq.Type, zapDomain string, privateKey []byte, ...) (*zmq.Socket, *zmq.Socket, error)
- func NewMonitor(socket *zmq.Socket, connection string, event zmq.Event) (*zmq.Socket, error)
- func NewServerSocket(socketType zmq.Type, zapDomain string, privateKey []byte, publicKey []byte, ...) (*zmq.Socket, error)
- func NewSignalPair(signal string) (receiver *zmq.Socket, sender *zmq.Socket, err error)
- func ParseKey(data string) ([]byte, bool, error)
- func ReadPrivateKey(key string) ([]byte, error)
- func ReadPublicKey(key string) ([]byte, error)
- func StartAuthentication() error
- type Client
- func (client *Client) Close() error
- func (client *Client) Connect(conn *util.Connection, serverPublicKey []byte, prefix string) error
- func (client *Client) ConnectedTo() *Connected
- func (client *Client) GoString() string
- func (client *Client) IsConnected() bool
- func (client *Client) IsConnectedTo(serverPublicKey []byte) bool
- func (client *Client) Receive(flags zmq.Flag) ([][]byte, error)
- func (client *Client) Reconnect() error
- func (client *Client) Send(items ...interface{}) error
- func (client *Client) ServerPublicKey() []byte
- func (client *Client) String() string
- type ClientIntf
- type Connected
- type Event
- type Poller
Constants ¶
const ( EVENT_CONNECTED = zmq.EVENT_CONNECTED EVENT_CONNECT_DELAYED = zmq.EVENT_CONNECT_DELAYED EVENT_CONNECT_RETRIED = zmq.EVENT_CONNECT_RETRIED EVENT_LISTENING = zmq.EVENT_LISTENING EVENT_BIND_FAILED = zmq.EVENT_BIND_FAILED EVENT_ACCEPTED = zmq.EVENT_ACCEPTED EVENT_ACCEPT_FAILED = zmq.EVENT_ACCEPT_FAILED EVENT_CLOSED = zmq.EVENT_CLOSED EVENT_CLOSE_FAILED = zmq.EVENT_CLOSE_FAILED EVENT_DISCONNECTED = zmq.EVENT_DISCONNECTED EVENT_MONITOR_STOPPED = zmq.EVENT_MONITOR_STOPPED EVENT_ALL = zmq.EVENT_ALL // ***** FIX THIS: not defined by zmq EVENT_HANDSHAKE_FAILED_NO_DETAIL = 0x0800 EVENT_HANDSHAKE_SUCCEEDED = 0x1000 EVENT_HANDSHAKE_FAILED_PROTOCOL = 0x2000 EVENT_HANDSHAKE_FAILED_AUTH = 0x4000 )
re-export zmq constants
Variables ¶
This section is empty.
Functions ¶
func CloseClients ¶
func CloseClients(clients []*Client)
CloseClients - disconnect old addresses and close all
func MakeKeyPair ¶
MakeKeyPair - create a new public/private keypair and write them to separate files
func NewBind ¶
func NewBind(log *logger.L, socketType zmq.Type, zapDomain string, privateKey []byte, publicKey []byte, listen []*util.Connection) (*zmq.Socket, *zmq.Socket, error)
NewBind - bind socket to a list of addresses creates up to 2 sockets for separate IPv4 and IPv6 traffic
func NewMonitor ¶ added in v0.7.3
NewMonitor - return a socket connection to the monitoring channel of another socket for connection state signalling a unique inproc://name must be provided for each use
func NewServerSocket ¶
func NewServerSocket(socketType zmq.Type, zapDomain string, privateKey []byte, publicKey []byte, v6 bool) (*zmq.Socket, error)
NewServerSocket - create a socket suitable for a server side connection
func NewSignalPair ¶
NewSignalPair -return a pair of connected PAIR sockets for shutdown signalling
func ReadPrivateKey ¶ added in v0.9.0
ReadPrivateKey - extract the private key from a string returning it as a 32 byte string
func ReadPublicKey ¶ added in v0.9.0
ReadPublicKey - extract the public key from a string returning it as a 32 byte string
func StartAuthentication ¶
func StartAuthentication() error
StartAuthentication - initialise the ZMQ security subsystem
Types ¶
type Client ¶
type Client struct { ClientIntf sync.Mutex // contains filtered or unexported fields }
Client - structure to hold a client connection
prefix:
REQ socket this adds an item before send SUB socket this adds/changes subscription
func NewClient ¶
func NewClient( socketType zmq.Type, privateKey []byte, publicKey []byte, timeout time.Duration, events zmq.Event, ) (*Client, <-chan Event, error)
NewClient - create a client socket ususlly of type zmq.REQ or zmq.SUB
func (*Client) ConnectedTo ¶ added in v0.6.0
ConnectedTo - return representation of client connection
func (*Client) GoString ¶ added in v0.11.0
GoString - return a basic information string for debugging purposes
func (*Client) IsConnected ¶
IsConnected - check if connected to a node
func (*Client) IsConnectedTo ¶
IsConnectedTo - check if connected to a specific node
func (*Client) ServerPublicKey ¶ added in v0.11.0
ServerPublicKey - return server's public key
type ClientIntf ¶ added in v0.11.0
type ClientIntf interface { Close() error Connect(conn *util.Connection, serverPublicKey []byte, prefix string) error ConnectedTo() *Connected GoString() string IsConnected() bool IsConnectedTo(serverPublicKey []byte) bool Reconnect() error Receive(flags zmq.Flag) ([][]byte, error) Send(items ...interface{}) error ServerPublicKey() []byte String() string }
type Poller ¶ added in v0.3.23
Poller - structure to hold a poller
func NewPoller ¶ added in v0.3.23
func NewPoller() *Poller
NewPoller - create a poller this is just to encapsulate the zmq poller to allow removal of a socket from a socket