asimov_protocol/gossip_protocol.rs
1// This is free and unencumbered software released into the public domain.
2
3//! The gossip protocol.
4
5use iroh::Endpoint;
6use iroh_gossip::{ALPN, Gossip};
7
8/// The ALPN string for the gossip protocol.
9pub const GOSSIP_ALPN: &[u8] = ALPN;
10
11/// The gossip protocol for use with `Router`.
12#[derive(Debug, Clone)]
13pub struct GossipProtocol(pub Gossip);
14
15impl GossipProtocol {
16 pub fn new(endpoint: Endpoint) -> Self {
17 Self(Gossip::builder().spawn(endpoint))
18 }
19}