Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel interface { // Context returns custom context if set, or returns context.Background. Context() context.Context // RemoteAddr returns the remote network address, same as net.Conn#RemoteAddr. RemoteAddr() net.Addr // LocalAddr returns the local network address, same as net.Conn#LocalAddr. LocalAddr() net.Addr // Write writes the message to channel and fires outbound middleware. Write(msg interface{}) error // IsActive returns false only when the channel closed. IsActive() bool // Close closing the channel after inbound and outbound event done. Close(ctx context.Context, err error) error // CloseReader closes the channel reader then the channel is unable to receive any message. CloseReader() // CloseWriter close the channel writer then the channel is unable to send any message. CloseWriter() // Readable returns the channel readable or not Readable() bool // Writeable returns the channel writeable or not Writeable() bool // AddOnChannelClosed adds OnChannelClosed hooks for this channel. AddOnChannelClosed(onChannelClosed ...OnChannelClosed) // AddInboundMiddleware adds inbound Middleware for this channel. AddInboundMiddleware(mw ...Middleware) // AddOutboundMiddleware adds outbound Middleware for this channel. AddOutboundMiddleware(mw ...Middleware) }
Channel defines the behaviors of channel.
type Interceptor ¶
type Interceptor func(message interface{}) bool
Interceptor defines the interceptor used to intercept message.
type Middleware ¶
Middleware is transport Middleware.
func Chain ¶
func Chain(ms ...Middleware) Middleware
Chain returns a Middleware that specifies the chained handler for transport.
Click to show internal directories.
Click to hide internal directories.