package tcp
import "github.com/influxdata/influxdb/tcp"
Package tcp provides a simple multiplexer over TCP.
Index ¶
- Constants
- func Dial(network, address string, header byte) (net.Conn, error)
- func MuxLogger(w io.Writer) *log.Logger
- type Mux
Constants ¶
const ( // DefaultTimeout is the default length of time to wait for first byte. DefaultTimeout = 30 * time.Second )
Functions ¶
func Dial ¶
Dial connects to a remote mux listener with a given header byte.
func MuxLogger ¶
Types ¶
type Mux ¶
type Mux struct { // The amount of time to wait for the first header byte. Timeout time.Duration // Out-of-band error logger Logger *log.Logger // contains filtered or unexported fields }
Mux multiplexes a network connection.
func NewMux ¶
NewMux returns a new instance of Mux.
func (*Mux) DefaultListener ¶
DefaultListener will return a net.Listener that will pass-through any connections with non-registered values for the first byte of the connection. The connections returned from this listener's Accept() method will replay the first byte of the connection as a short first Read().
This can be used to pass to an HTTP server, so long as there are no conflicts with registered listener bytes and the first character of the HTTP request: 71 ('G') for GET, etc.
func (*Mux) Listen ¶
Listen returns a listener identified by header. Any connection accepted by mux is multiplexed based on the initial header byte.
func (*Mux) Serve ¶
Serve handles connections from ln and multiplexes then across registered listeners.
Source Files ¶
- Version
- v1.12.0 (latest)
- Published
- Apr 8, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 2 days ago –
Tools for package owners.