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 Name | Type | Unit (optional) | Description | Attributes |
|---|---|---|---|---|
sbd.server.open_connections | f64_up_down_counter | count | The current number of open connections | |
sbd.server.ip_rate_limited | u64_counter | count | The 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_send | u64_counter | bytes | The 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_recv | u64_counter | bytes | The 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_failures | u64_counter | count | The 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§
- Auth
Token Tracker - 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.
- WeakC
Slot - A weak reference to a connection slot container.
Enums§
- Authenticate
Token Error - Authenticate token error type.
- Maybe
TlsStream - 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.