Skip to main content

redact_dsn

Function redact_dsn 

Source
pub fn redact_dsn(dsn: &str) -> String
Expand description

Redact the password from a DSN string for safe inclusion in logs and error messages.

Handles both the URL credential format (quic://user:pass@host) and the query-parameter format (?password=xxx / ?pass=xxx), replacing the secret with [REDACTED]. DSNs without credentials are returned unchanged. Mirrors the Go reference client’s RedactDSN.

§Example

use geode_client::redact_dsn;

let safe = redact_dsn("quic://user:secret@host:3141");
assert!(safe.contains("[REDACTED]"));
assert!(!safe.contains("secret"));