Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Listener *net.TCPListener TLSConfig *tls.Config Dispatcher Dispatcher Deadline time.Duration LogOutput io.Writer }
Config is used to create a new yamuxer.
type Dispatcher ¶
type Dispatcher interface { // Register adds a Handler for the given type. Register(StreamType, Handler) // RegisterFunc adds a HandlerFunc for the given type. RegisterFunc(StreamType, HandlerFunc) // Dispatch reads the first byte and passes the connection to the handler // for the given type. Dispatch(grim.GrimReaper, net.Conn) }
Dispatcher processes stream connections and hands them off to the registered handler.
func NewDispatcher ¶
func NewDispatcher(l log.Logger, unknownHandler Handler) Dispatcher
NewDispatcher creates a Dispatcher implementation which also allows for the optional handling of unknown streams. If the unknown handler is nil, the streams will be closed immediately.
type HandlerFunc ¶
HandlerFunc handles incoming stream connections.
type StreamType ¶
type StreamType byte
StreamType is the stream enum. There can only be one handler per type. 0x00 is a reserved StreamType.
var UnknownStreamType StreamType = 0x00
UnknownStreamType is a cautionary type as it covered the nil byte.
Click to show internal directories.
Click to hide internal directories.