Skip to main content

Module conn_string

Module conn_string 

Source
Expand description

Connection-string parser shared across reddb, reddb-client, red_client, and every language driver.

Pure function over a string; no I/O, no allocation beyond what the returned ConnectionTarget needs. The grammar is defined by docs/clients/connection-strings.md; this module is the canonical parser and is the single source of truth consumed by the rest of the workspace.

The parser ports the logic that previously lived in drivers/rust/src/connect.rs (which keeps a thin re-export layer for backwards compatibility while drivers migrate over). Cluster URIs (grpc://primary,replica:port), default ports per scheme, and the ?route=primary override behave identically to the original.

Structs§

ConnStringLimits
DoS guardrails applied by parse before any URI work happens.
ConnectionSpec
Connection target plus URL-derived auth metadata.
ParseError
Error returned by parse.

Enums§

ConnectionAuth
Authentication material derived from a connection string or adjacent CLI fallback. Debug deliberately redacts every caller-supplied credential.
ConnectionScheme
URI schemes accepted by the connection-string parser.
ConnectionTarget
Normalised target produced by parse.
ParseErrorKind
Stable error code for parser failures.

Constants§

DEFAULT_PORT_GRPC
DEFAULT_PORT_GRPCS
DEFAULT_PORT_RED
Default port per documented scheme. Centralised so other crates (the connector, server-side dispatch) can stay consistent.
DEFAULT_PORT_WS
Default ports for ws:// / red+ws:// and wss:// / red+wss:// — align with the standard WS / WSS browser defaults (80 and 443) so a hosted endpoint like *.db.reddb.io works without an explicit port.
DEFAULT_PORT_WSS
SUPPORTED_SCHEMES
Stable parser-owned list of supported URI schemes.

Functions§

is_embedded_connection_uri
Return true for documented embedded aliases that must not resolve to a remote transport target.
parse
Parse a connection URI into a ConnectionTarget under the default DoS limits.
parse_with_auth
Parse a connection URI and derive auth from RFC 3986 userinfo.
parse_with_limits
Same as parse but with caller-supplied DoS guardrails. Useful for tests that need tighter limits or for callers (a future admin tool, an offline validator) that need to relax the defaults.