Crates.io | certstreamrs |
lib.rs | certstreamrs |
version | 0.1.1 |
source | src |
created_at | 2022-03-25 21:57:08.763188 |
updated_at | 2022-03-25 22:03:26.182948 |
description | A library for streaming Certificate Transparency Log events from the certstream service |
homepage | |
repository | https://github.com/Andoryuuta/certstream-rs |
max_upload_size | |
id | 556446 |
size | 36,912 |
An unofficial port of certstream-go to Rust.
This library streams Certificate Transparency Log notifications from https://certstream.calidog.io/ (or a custom instance of the certstream-server).
This was done as a small project to learn Rust. All comments/criticism/pull requests welcome -- the code quality is likely terrible.
> git clone https://github.com/Andoryuuta/certstream-rs
> cd certstream-rs
> cargo run --example watch_hostnames
use certstreamrs::CertstreamClient;
use futures_util::{pin_mut, StreamExt};
#[tokio::main]
async fn main() {
// Create the client and open the connection/stream.
let client = CertstreamClient::default();
let stream = client.watch_certs();
pin_mut!(stream);
// Read from the stream and print the certificate message.
loop {
let msg = stream.next().await.unwrap().unwrap();
println!(
"Source: {} | First Hostname: {}",
msg.data.source.name,
msg.data.leaf_cert.all_domains.first().unwrap()
);
}
}