Documentation ¶
Index ¶
- Variables
- type Config
- type Conn
- func (m *Conn) Close() error
- func (m *Conn) Flush() (n int, err error)
- func (m *Conn) Len() (n int)
- func (m *Conn) LocalAddr() net.Addr
- func (m *Conn) Read(p []byte) (int, error)
- func (m *Conn) RemoteAddr() net.Addr
- func (m *Conn) SetDeadline(t time.Time) error
- func (m *Conn) SetReadDeadline(t time.Time) error
- func (m *Conn) SetWriteDeadline(t time.Time) error
- func (m *Conn) Write(p []byte) (int, error)
- type ErrNotMatched
- type ErrorHandler
- type Listener
- func (m *Listener) Accept() (net.Conn, error)
- func (m *Listener) Addr() net.Addr
- func (m *Listener) Close() error
- func (m *Listener) HandleError(h ErrorHandler)
- func (m *Listener) Match(matchers ...Matcher) net.Listener
- func (m *Listener) Serve() error
- func (m *Listener) ServeAsync(matcher Matcher, serve func(l net.Listener) error)
- func (m *Listener) SetReadTimeout(t time.Duration)
- type Matcher
- type Server
Constants ¶
This section is empty.
Variables ¶
var ErrListenerClosed = errListenerClosed("mux: listener closed")
ErrListenerClosed is returned from muxListener.Accept when the underlying listener is closed.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { TLS *tls.Config // The TLS/SSL configuration. FlushRate int // The maximum flush rate (QPS) per connection. }
Config represents the configuration of the listener.
type Conn ¶
Conn wraps a net.Conn and provides transparent sniffing of connection data.
func (*Conn) Close ¶
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*Conn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
func (*Conn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call.
type ErrNotMatched ¶
type ErrNotMatched struct {
// contains filtered or unexported fields
}
ErrNotMatched is returned whenever a connection is not matched by any of the matchers registered in the multiplexer.
func (ErrNotMatched) Error ¶
func (e ErrNotMatched) Error() string
func (ErrNotMatched) Temporary ¶
func (e ErrNotMatched) Temporary() bool
Temporary implements the net.Error interface.
func (ErrNotMatched) Timeout ¶
func (e ErrNotMatched) Timeout() bool
Timeout implements the net.Error interface.
type ErrorHandler ¶
ErrorHandler handles an error and notifies the listener on whether it should continue serving.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener represents a listener used for multiplexing protocols.
func New ¶
New announces on the local network address laddr. The syntax of laddr is "host:port", like "127.0.0.1:8080". If host is omitted, as in ":8080", New listens on all available interfaces instead of just the interface with the given host address. Listening on a hostname is not recommended because this creates a socket for at most one of its IP addresses.
func (*Listener) HandleError ¶
func (m *Listener) HandleError(h ErrorHandler)
HandleError registers an error handler that handles listener errors.
func (*Listener) Match ¶
Match returns a net.Listener that sees (i.e., accepts) only the connections matched by at least one of the matcher.
func (*Listener) ServeAsync ¶
ServeAsync adds a protocol based on the matcher and serves it.
func (*Listener) SetReadTimeout ¶
SetReadTimeout sets a timeout for the read of matchers.