clientconn

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 30 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 added in v0.0.6

func (l *Listener) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Listener) Describe added in v0.0.6

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 done or some unrecoverable error occurs.

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

func (*Listener) TCPAddr added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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
	Mode           Mode
	Metrics        *connmetrics.ListenerMetrics
	Handler        handlers.Interface
	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