Skip to main content

bestool_canopy/
lib.rs

1use std::fmt;
2
3mod client;
4
5pub use client::{
6	CERT_RENEW_AFTER, CanopyClient, ClientBuilderFactory, DEFAULT_CANOPY_URL, NewEvent, Severity,
7	TAILSCALE_URL, client_builder, user_agent,
8};
9
10/// Wraps a sensitive value so its `Debug` output doesn't leak the contents.
11#[derive(Clone)]
12pub struct Redacted<T>(pub T);
13
14impl<T> fmt::Debug for Redacted<T> {
15	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16		f.write_str("<redacted>")
17	}
18}
19
20impl<T> std::ops::Deref for Redacted<T> {
21	type Target = T;
22	fn deref(&self) -> &T {
23		&self.0
24	}
25}