Crate sbd_server

Crate sbd_server 

Source
Expand description

Sbd server library.

§Metrics

The server exports the following OpenTelemetry metrics if an OTLP endpoint is configured.

Prometheus example: sbd-serverd --otlp-endpoint http://localhost:9090/api/v1/otlp/v1/metrics

Full Metric NameTypeUnit (optional)DescriptionAttributes
sbd.server.open_connectionsf64_up_down_countercountThe current number of open connections
sbd.server.ip_rate_limitedu64_countercountThe number of connections that have been closed because of an IP rate limiting violation- pub_key: The base64 encoded public key declared by the offending connection.
- kind: Has two possible values. It will be “auth” for violations during authentication and “msg” for violations while sending messages.
sbd.server.bytes_sendu64_counterbytesThe number of bytes sent per public key. Resets when a new connection is opened.- pub_key: The base64 encoded public key declared by the offending connection.
sbd.server.bytes_recvu64_counterbytesThe number of bytes received per public key. Resets when a new connection is opened.- pub_key: The base64 encoded public key declared by the offending connection.
sbd.server.auth_failuresu64_countercountThe number of failed authentication attempts.- pub_key: The base64 encoded public key declared by the offending connection. This is only present if an invalid token is used with a specific public key.

Re-exports§

pub use ws::Payload;
pub use ws::SbdWebsocket;

Modules§

ws
Websocket backend abstraction.

Structs§

AuthTokenTracker
Utility for managing auth tokens.
CSlot
A connection slot container.
Config
Configure and execute an SBD server.
IpRate
Rate limit connections by IP address.
PubKey
Public key.
SbdServer
SbdServer.
TlsConfig
RustTLS config plus cert and pk paths.
WeakCSlot
A weak reference to a connection slot container.

Enums§

AuthenticateTokenError
Authenticate token error type.
MaybeTlsStream
A stream that might be protected with TLS.

Functions§

enable_otlp_metrics_if_configured
Enable OpenTelemetry metrics export if enabled in the given config.
handle_upgraded
Handle an upgraded websocket connection.
preflight_ip_check
If the check passes, the canonical IP is returned, otherwise None and the connection should be dropped.
process_authenticate_token
Handle receiving a PUT “/authenticate” rest api request.
spawn_prune_task
Spawn a Tokio task to prune the IpRate map.
to_canonical_ip
Convert an IP address to an IPv6 address.