pub struct CertstreamClient { /* private fields */ }
Implementations§
Source§impl CertstreamClient
impl CertstreamClient
pub fn new(name: &str) -> Self
Sourcepub fn watch_certs(
&self,
) -> impl Stream<Item = Result<CertstreamMessage, Box<dyn Error>>>
pub fn watch_certs( &self, ) -> impl Stream<Item = Result<CertstreamMessage, Box<dyn Error>>>
Examples found in repository?
examples/watch_hostnames.rs (line 8)
5async fn main() {
6 // Create the client and open the connection/stream.
7 let client = CertstreamClient::default();
8 let stream = client.watch_certs();
9 pin_mut!(stream);
10
11 // Read from the stream and print the certificate message.
12 loop {
13 let msg = match stream.next().await {
14 Some(msg) => msg.unwrap(),
15 None => continue,
16 };
17
18 // Join the hostnames into a single string.
19 let mut hostnames = String::new();
20 for hostname in msg.data.leaf_cert.all_domains {
21 hostnames.push_str(&hostname);
22 hostnames.push('|');
23 }
24
25 println!(
26 "Source: {} | Hostname(s): {}",
27 msg.data.source.name, hostnames
28 );
29 }
30}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CertstreamClient
impl RefUnwindSafe for CertstreamClient
impl Send for CertstreamClient
impl Sync for CertstreamClient
impl Unpin for CertstreamClient
impl UnwindSafe for CertstreamClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more