Documentation
¶
Overview ¶
Package clientconn provides wire protocol server implementation.
Index ¶
- func NewListenerMetrics() *listenerMetrics
- type Listener
- func (l *Listener) Collect(ch chan<- prometheus.Metric)
- func (l *Listener) Describe(ch chan<- *prometheus.Desc)
- func (l *Listener) Listening() bool
- func (l *Listener) Run(ctx context.Context)
- func (l *Listener) TCPAddr() net.Addr
- func (l *Listener) TLSAddr() net.Addr
- func (l *Listener) UnixAddr() net.Addr
- type ListenerOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewListenerMetrics ¶ added in v2.7.0
func NewListenerMetrics() *listenerMetrics
NewListenerMetrics creates new listener metrics.
Types ¶
type Listener ¶
type Listener struct {
*ListenerOpts
// contains filtered or unexported fields
}
Listener listens on one or multiple interfaces (TCP, Unix, TLS sockets) and accepts incoming client connections.
func Listen ¶
func Listen(opts *ListenerOpts) (l *Listener, err error)
Listen creates a new listener and starts listening on configured interfaces. Listener.Run must be called on the returned value.
func (*Listener) Collect ¶
func (l *Listener) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Listener) Describe ¶
func (l *Listener) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
func (*Listener) Listening ¶
Listening returns true if the listener is currently listening and accepting new connection.
It returns false when listener is stopped or when it is still running with established connections.
func (*Listener) Run ¶
Run runs the listener (and handler) until ctx is canceled.
When this method returns, listener and all connections are closed, and handler is stopped.
func (*Listener) TCPAddr ¶
TCPAddr returns TCP listener's address, or nil, if TCP listener is disabled. It can be used to determine an actually used port, if it was zero.
type ListenerOpts ¶
type ListenerOpts struct {
M *middleware.Middleware
Logger *slog.Logger
TCP string // empty value disables TCP listener
Unix string // empty value disables Unix listener
TLS string // empty value disables TLS listener
TLSCertFile string
TLSKeyFile string
TLSCAFile string
Mode middleware.Mode
ProxyAddr string
ProxyTLSCertFile string
ProxyTLSKeyFile string
ProxyTLSCAFile string
TestRecordsDir string // if empty, no records are created
}
ListenerOpts represents listener configuration.