clientconn

package
v0.0.0-...-bb56650 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package clientconn provides client connection implementation.

Index

Constants

This section is empty.

Variables

AllModes includes all operation modes, with the first one being the default.

Functions

This section is empty.

Types

type Listener

type Listener struct {
	*NewListenerOpts
	// contains filtered or unexported fields
}

Listener listens on one or multiple interfaces (TCP, Unix, TLS sockets) and accepts incoming client connections.

func NewListener

func NewListener(opts *NewListenerOpts) *Listener

NewListener returns a new listener, configured by the NewListenerOpts argument.

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) Run

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

Run runs the listener until ctx is canceled or some unrecoverable error occurs.

When this method returns, listener and all connections, as well as handler are closed.

func (*Listener) TCPAddr

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

TCPAddr returns TCP listener's address. 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. 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.

type Mode

type Mode string

Mode represents FerretDB mode of operation.

const (
	// NormalMode only handles requests.
	NormalMode Mode = "normal"
	// ProxyMode only proxies requests to another wire protocol compatible service.
	ProxyMode Mode = "proxy"
	// DiffNormalMode both handles requests and proxies them, then logs the diff.
	// Only the FerretDB response is sent to the client.
	DiffNormalMode Mode = "diff-normal"
	// DiffProxyMode both handles requests and proxies them, then logs the diff.
	// Only the proxy response is sent to the client.
	DiffProxyMode Mode = "diff-proxy"
)

type NewListenerOpts

type NewListenerOpts struct {
	TCP  string
	Unix string

	TLS         string
	TLSCertFile string
	TLSKeyFile  string
	TLSCAFile   string

	ProxyAddr        string
	ProxyTLSCertFile string
	ProxyTLSKeyFile  string
	ProxyTLSCAFile   string

	Mode           Mode
	Metrics        *connmetrics.ListenerMetrics
	Handler        *handler.Handler
	Logger         *zap.Logger
	TestRecordsDir string // if empty, no records are created
}

NewListenerOpts represents listener configuration.

Directories

Path Synopsis
Package conninfo provides access to connection-specific information.
Package conninfo provides access to connection-specific information.
Package connmetrics provides listener and connection metrics.
Package connmetrics provides listener and connection metrics.
Package cursor provides access to cursor registry.
Package cursor provides access to cursor registry.

Jump to

Keyboard shortcuts

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