clientconn

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: Apache-2.0 Imports: 29 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 accepts incoming client connections.

func NewListener

func NewListener(opts *NewListenerOpts) *Listener

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

func (*Listener) Addr added in v0.1.0

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

Addr returns TCP listener's address. It can be used to determine an actually used port, if it was zero.

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) TLS added in v0.7.1

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

TLS returns TLS listener address.

func (*Listener) Unix added in v0.6.0

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

Unix returns Unix domain socket address.

type ListenerOpts added in v0.7.1

type ListenerOpts struct {
	Addr        string
	Unix        string
	TLS         string
	TLSCertFile string
	TLSKeyFile  string
	TLSCAFile   string
}

ListenerOpts represents listener configuration options.

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 {
	Listener       ListenerOpts
	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 a ConnInfo struct that is used to handle connection-specificinfo and can be shared through context.
Package conninfo provides a ConnInfo struct that is used to handle connection-specificinfo and can be shared through context.
Package connmetrics provides listener and connection metrics.
Package connmetrics provides listener and connection metrics.

Jump to

Keyboard shortcuts

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