Documentation ¶
Index ¶
- Constants
- Variables
- func FindMechanism(name string) (func() zmtp.Mechanism, bool)
- func RegisterMechanism(name string, mech func() zmtp.Mechanism) error
- func RegisterSocketType(name string, constructor SocketConstructor) error
- func RegisterTransport(name string, fac TransportFactory) error
- type Config
- func (c *Config) ConnectTimeout() time.Duration
- func (c *Config) Default()
- func (c *Config) QueueLen() int
- func (c *Config) ReconnectTimeout() time.Duration
- func (c *Config) SetConnectTimeout(d time.Duration)
- func (c *Config) SetQueueLen(queueLen int)
- func (c *Config) SetReconnectTimeout(d time.Duration)
- type Context
- type Event
- type EventBus
- type EventType
- type PrintBus
- type Socket
- func (s Socket) Bind(addr string) error
- func (s Socket) Close() error
- func (s Socket) Connect(addr string) error
- func (s Socket) Disconnect(addr string) error
- func (s Socket) Recv() ([][]byte, error)
- func (s Socket) Send(data [][]byte) error
- func (s Socket) SetOption(option string, val any) error
- func (s Socket) SetServer(serv bool) error
- func (s Socket) Unbind(addr string) error
- type SocketConstructor
- type SocketDriver
- type TransportFactory
Constants ¶
View Source
const ( EventTypeConnected = EventType(0) EventTypeDisconnected = EventType(1) EventTypeConnectFailed = EventType(2) EventTypeAccepted = EventType(3) EventTypeAcceptFailed = EventType(4) EventTypeFailedGreeting = EventType(5) EventTypeFailedHandshake = EventType(6) EventTypeReady = EventType(7) )
Variables ¶
View Source
var ErrMechanismExists mechanismExists
View Source
var ErrMechanismNotFound mechanismNotFound
View Source
var ErrTransportExists transportExists
View Source
var ErrTransportNotFound transportNotFound
View Source
var ErrTypeExists typeExists
View Source
var ErrTypeNotFound typeNotFound
Functions ¶
func RegisterSocketType ¶
func RegisterSocketType( name string, constructor SocketConstructor, ) error
func RegisterTransport ¶
func RegisterTransport(name string, fac TransportFactory) error
Types ¶
type Config ¶
func (*Config) ConnectTimeout ¶
func (*Config) ReconnectTimeout ¶
func (*Config) SetConnectTimeout ¶
func (*Config) SetQueueLen ¶
func (*Config) SetReconnectTimeout ¶
type Context ¶
func NewContext ¶
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
func (Socket) Disconnect ¶
type SocketConstructor ¶
type SocketConstructor func( ctx context.Context, mech zmtp.Mechanism, conf *Config, eventBus EventBus, ) (SocketDriver, error)
SocketConstructor constructs a socket.
func FindSocketType ¶
func FindSocketType(name string) (SocketConstructor, bool)
type SocketDriver ¶
type SocketDriver interface { // Name of the type. Name() string // Connect to the remote address using the given transport. Connect(tp transport.Transport, url *url.URL) error // Disconnect from the address. Disconnect(url *url.URL) error // Bind to the given address using the given transport. Bind(tp transport.Transport, url *url.URL) error // Unbind from the bound address. Unbind(url *url.URL) error // Send a message over the socket. Send([]zmtp.Message) error // Recv either a command or a message on the socket. Recv() ([]zmtp.Message, error) // Close the socket Close() error }
SocketDriver represents a type of socket in a communitcation pattern.
type TransportFactory ¶
TransportFactory creates a transport given a list of key value pairs.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.