Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrListenerClosed = errListenerClosed("net: listener closed")
ErrListenerClosed is returned from Listener.Accept when the underlying listener is closed.
var Ipv4LoopbackHosts = []string{"localhost", "127.0.0.1"}
var Ipv6LoopbackHosts = []string{"localhost", "[::1]", "::1"}
Functions ¶
func IsLoopbackHost ¶
func LoopbackListener ¶
LoopbackListener returns a loopback listener on a first usable port in ports or 0 if ports is empty
func OnceCloseListener ¶
OnceCloseListener wraps a net.Listener, protecting it from multiple Close calls.
func TcpKeepAliveListener ¶
TcpKeepAliveListener sets TCP keep-alive timeouts on accepted connections. It's used by ListenAndServe and ListenAndServeTLS so dead TCP connections (e.g. closing laptop mid-download) eventually go away.
Types ¶
type MultiListener ¶
type MultiListener struct { *NotifyListener // ErrorLog specifies an optional logger for errors accepting // connections, unexpected behavior from handlers, and // underlying FileSystem errors. // If nil, logging is done via the log package's standard logger. ErrorLog *log.Logger // contains filtered or unexported fields }
MultiListener is a net.Listener that accepts all the connections from all listeners.
func NewMultiListener ¶
func NewMultiListener(listeners ...net.Listener) *MultiListener
func (*MultiListener) Addr ¶
func (l *MultiListener) Addr() net.Addr
Addr returns the listener's network address.
func (*MultiListener) Close ¶
func (l *MultiListener) Close() error
type NotifyListener ¶
func NewNotifyListener ¶
func NewNotifyListener() *NotifyListener
NewNotifyListener creates a new Listener that will recv conns on its channel.
func (*NotifyListener) Addr ¶
func (l *NotifyListener) Addr() net.Addr
Addr returns the listener's network address.
func (*NotifyListener) Close ¶
func (l *NotifyListener) Close() error
Stop prevents the NotifyListener from firing. To ensure the channel is empty after a call to Close, check the return value and drain the channel.
func (*NotifyListener) DoneC ¶
func (l *NotifyListener) DoneC() <-chan struct{}
DoneC returns whether this listener has been closed for multi producers of C
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
https://tools.ietf.org/html/rfc7064 https://tools.ietf.org/html/rfc7064 3.2.
|
https://tools.ietf.org/html/rfc7064 https://tools.ietf.org/html/rfc7064 3.2. |
Package mux is a library to multiplex network connections based on their payload.
|
Package mux is a library to multiplex network connections based on their payload. |