Documentation ¶
Index ¶
- func BindServer(s Server, endpoint string) (net.Addr, error)
- func ConnectClient(c Client, endpoint string) error
- type Client
- type ClientSocket
- type Connection
- type PullSocket
- type PushSocket
- type Server
- type ServerSocket
- type Socket
- func (s *Socket) AddConnection(conn *Connection)
- func (s *Socket) Close()
- func (s *Socket) Recv() ([]byte, error)
- func (s *Socket) RecvChannel() chan *zmtp.Message
- func (s *Socket) RemoveConnection(uuid string)
- func (s *Socket) RetryInterval() time.Duration
- func (s *Socket) SecurityMechanism() zmtp.SecurityMechanism
- func (s *Socket) Send(b []byte) error
- func (s *Socket) SocketType() zmtp.SocketType
- type ZeroMQSocket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindServer ¶
BindServer accepts a Server interface and an endpoint in the format <proto>://<address>:<port>. It then attempts to bind to the endpoint. TODO: change this to starting a listener on the endpoint that performs handshakes with any client that connects
func ConnectClient ¶
ConnectClient accepts a Client interface and an endpoint in the format <proto>://<address>:<port>. It then attempts to connect to the endpoint and perform a ZMTP handshake.
Types ¶
type Client ¶
type Client interface { ZeroMQSocket Connect(endpoint string) error }
Client is a gomq interface used for client sockets. It implements the Socket interface along with a Connect method for connecting to endpoints.
func NewClient ¶
func NewClient(mechanism zmtp.SecurityMechanism) Client
NewClient accepts a zmtp.SecurityMechanism and returns a ClientSocket as a gomq.Client interface.
func NewPull ¶
func NewPull(mechanism zmtp.SecurityMechanism) Client
NewPull accepts a zmtp.SecurityMechanism and returns a PullSocket as a gomq.Pull interface.
type ClientSocket ¶
type ClientSocket struct {
*Socket
}
ClientSocket is a ZMQ_CLIENT socket type. See: http://rfc.zeromq.org/spec:41
func (*ClientSocket) Connect ¶
func (c *ClientSocket) Connect(endpoint string) error
Connect accepts a zeromq endpoint and connects the client socket to it. Currently the only transport supported is TCP. The endpoint string should be in the format "tcp://<address>:<port>".
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is a gomq connection. It holds both the net.Conn transport as well as the zmtp connection information.
func NewConnection ¶
func NewConnection(netConn net.Conn, zmtpConn *zmtp.Connection) *Connection
NewConnection accepts a net.Conn, a *zmtp.Connection and returns a *gomq.Connection.
type PullSocket ¶
type PullSocket struct {
*Socket
}
PullSocket is a ZMQ_PULL socket type. See: http://rfc.zeromq.org/spec:41
func (*PullSocket) Connect ¶
func (c *PullSocket) Connect(endpoint string) error
Connect accepts a zeromq endpoint and connects the pull socket to it. Currently the only transport supported is TCP. The endpoint string should be in the format "tcp://<address>:<port>".
type PushSocket ¶
type PushSocket struct {
*Socket
}
PushSocket is a ZMQ_PUSH socket type. See: http://rfc.zeromq.org/spec:41
type Server ¶
type Server interface { ZeroMQSocket Bind(endpoint string) (net.Addr, error) }
Server is a gomq interface used for server sockets. It implements the Socket interface along with a Bind method for binding to endpoints.
func NewPush ¶
func NewPush(mechanism zmtp.SecurityMechanism) Server
NewPush accepts a zmtp.SecurityMechanism and returns a PushSocket as a gomq.Push interface.
func NewServer ¶
func NewServer(mechanism zmtp.SecurityMechanism) Server
NewServer accepts a zmtp.SecurityMechanism and returns a ServerSocket as a gomq.Server interface.
type ServerSocket ¶
type ServerSocket struct {
*Socket
}
ServerSocket is a ZMQ_SERVER socket type. See: http://rfc.zeromq.org/spec:41
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket is the base GoMQ socket type. It should probably not be used directly. Specifically typed sockets such as ClientSocket, ServerSocket, etc embed this type.
func NewSocket ¶
func NewSocket(asServer bool, sockType zmtp.SocketType, mechanism zmtp.SecurityMechanism) *Socket
NewSocket accepts an asServer boolean, zmtp.SocketType and a zmtp.SecurityMechanism and returns a *Socket.
func (*Socket) AddConnection ¶
func (s *Socket) AddConnection(conn *Connection)
AddConnection adds a gomq.Connection to the socket. It is goroutine safe.
func (*Socket) Close ¶
func (s *Socket) Close()
Close closes all underlying transport connections for the socket.
func (*Socket) RecvChannel ¶
RecvChannel returns the Socket's receive channel used for receiving messages.
func (*Socket) RemoveConnection ¶
RemoveConnection accepts the uuid of a connection and removes that gomq.Connection from the socket if it exists. FIXME will bomb if uuid does not exist in map
func (*Socket) RetryInterval ¶
RetryInterval returns the retry interval used for asyncronous bind / connect.
func (*Socket) SecurityMechanism ¶
func (s *Socket) SecurityMechanism() zmtp.SecurityMechanism
SecurityMechanism returns the Socket's zmtp.SecurityMechanism.
func (*Socket) SocketType ¶
func (s *Socket) SocketType() zmtp.SocketType
SocketType returns the Socket's zmtp.SocketType.
type ZeroMQSocket ¶
type ZeroMQSocket interface { Recv() ([]byte, error) Send([]byte) error RetryInterval() time.Duration SocketType() zmtp.SocketType SecurityMechanism() zmtp.SecurityMechanism AddConnection(*Connection) RemoveConnection(string) RecvChannel() chan *zmtp.Message Close() }
ZeroMQSocket is the base gomq interface.