clientconn

package
v2.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package clientconn provides wire protocol server implementation.

Index

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

func (l *Listener) Listening() bool

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

func (l *Listener) Run(ctx context.Context)

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

func (l *Listener) TCPAddr() net.Addr

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.

func (*Listener) TLSAddr

func (l *Listener) TLSAddr() net.Addr

TLSAddr returns TLS listener's address, or nil, if TLS listener is disabled. It can be used to determine an actually used port, if it was zero.

func (*Listener) UnixAddr

func (l *Listener) UnixAddr() net.Addr

UnixAddr returns Unix domain socket listener's address, or nil, if Unix listener is disabled.

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.

Directories

Path Synopsis
Package conninfo provides access to connection-specific information.
Package conninfo provides access to connection-specific information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL