Documentation
¶
Overview ¶
Package muxlistener provides a protocol-multiplexing net.Listener that peeks at the first bytes of each accepted connection to determine whether it speaks RTSP or HTTP, then routes it to the appropriate sub-listener.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MuxListener ¶
type MuxListener struct {
// contains filtered or unexported fields
}
MuxListener wraps a net.Listener and routes accepted connections to either an RTSP or HTTP sub-listener based on protocol detection.
func New ¶
func New(inner net.Listener) *MuxListener
New creates a MuxListener that routes connections from inner. Call RTSP() and HTTP() to obtain the sub-listeners, then call Serve() to start accepting and routing.
func (*MuxListener) Close ¶
func (m *MuxListener) Close() error
Close stops routing and closes the inner listener.
func (*MuxListener) HTTP ¶
func (m *MuxListener) HTTP() net.Listener
HTTP returns a net.Listener that yields HTTP connections.
func (*MuxListener) RTSP ¶
func (m *MuxListener) RTSP() net.Listener
RTSP returns a net.Listener that yields RTSP connections.
func (*MuxListener) Serve ¶
func (m *MuxListener) Serve() error
Serve accepts connections from the inner listener and routes them. It blocks until the inner listener is closed or Close is called.