Documentation ¶
Overview ¶
various comm ZMq routines shared be all commands
Index ¶
- 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 NewServerSocket(socketType zmq.Type, zapDomain string, privateKey []byte, publicKey []byte, ...) (*zmq.Socket, error)
- func NewSignalPair(signal string) (*zmq.Socket, *zmq.Socket, error)
- func ReadKeyFile(keyFileName string) ([]byte, bool, error)
- func ReadPrivateKeyFile(keyFileName string) ([]byte, error)
- func ReadPublicKeyFile(keyFileName string) ([]byte, error)
- func StartAuthentication() error
- type Client
- func (client *Client) Add(poller *zmq.Poller, state zmq.State) (*zmq.Socket, int)
- func (client *Client) Age() time.Duration
- func (client *Client) Close() error
- func (client *Client) Connect(conn *util.Connection, serverPublicKey []byte) error
- func (client *Client) IsConnected() bool
- func (client *Client) IsConnectedTo(serverPublicKey []byte) bool
- func (client *Client) IsDisconnected() 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) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func 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)
bind a list of addresses creates up to 2 sockets for separate IPv4 and IPv6 traffic
func NewServerSocket ¶
func NewServerSocket(socketType zmq.Type, zapDomain string, privateKey []byte, publicKey []byte, v6 bool) (*zmq.Socket, error)
create a socket suitable for a server side connection
func NewSignalPair ¶
return a pair of connected push/pull sockets for shutdown signalling
func ReadKeyFile ¶
read a public key from a file returning it as a 32 byte string
func ReadPrivateKeyFile ¶
read a private key from a file returning it as a 32 byte string
func ReadPublicKeyFile ¶
read a public key from a file returning it as a 32 byte string
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
structure to hold a client connection
func NewClient ¶
func NewClient(socketType zmq.Type, privateKey []byte, publicKey []byte, timeout time.Duration) (*Client, error)
create a cliet socket ususlly of type zmq.REQ or zmq.SUB
func (*Client) Connect ¶
func (client *Client) Connect(conn *util.Connection, serverPublicKey []byte) error
disconnect old address and connect to new
func (*Client) IsConnectedTo ¶
check if connected to a specific node
func (*Client) IsDisconnected ¶
check if not connected to any node