Documentation
¶
Overview ¶
Package clientconn provides client connection implementation.
Index ¶
- Variables
- 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 Mode
- type NewListenerOpts
Constants ¶
This section is empty.
Variables ¶
var AllModes = []string{ string(NormalMode), string(ProxyMode), string(DiffNormalMode), string(DiffProxyMode), }
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 Listen ¶ added in v1.23.0
func Listen(opts *NewListenerOpts) (*Listener, error)
Listen creates a new listener and starts listening on configured interfaces.
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) Listening ¶ added in v1.23.0
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 until ctx is canceled.
When this method returns, listener and all connections, as well as handler are closed.
func (*Listener) TCPAddr ¶ added in v0.9.0
TCPAddr returns TCP listener's address. It can be used to determine an actually used port, if it was zero.
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 *slog.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. |