#certificate-transparency #log #streaming #events #service #stream-ext #certstream

certstreamrs

A library for streaming Certificate Transparency Log events from the certstream service

2 releases

0.1.1 Mar 25, 2022
0.1.0 Mar 25, 2022

#9 in #certificate-transparency

MIT license

11KB
139 lines

certstream-rs

An unofficial port of certstream-go to Rust.

MIT licensed Crates.io

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.

Example

> git clone https://github.com/Andoryuuta/certstream-rs
> cd certstream-rs
> cargo run --example watch_hostnames

Usage

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()
        );
    }
}

Dependencies

~7–18MB
~275K SLoC