add gossip join api

webxdcs can now have multiple gossip channels and decide where to send the message to.
This commit is contained in:
Sebastian Klähn
2024-01-25 18:09:25 +01:00
parent 5d775231d0
commit d13d8d48ec
8 changed files with 124 additions and 136 deletions

View File

@@ -8,14 +8,13 @@ use std::fmt;
use std::io::{Cursor, Write};
use std::mem;
use std::path::{Path, PathBuf};
use std::str::{from_utf8, FromStr};
use std::str::from_utf8;
use std::time::{Duration, SystemTime};
use anyhow::{bail, Context as _, Result};
use base64::Engine as _;
use chrono::{Local, NaiveDateTime, NaiveTime, TimeZone};
use futures::{StreamExt, TryStreamExt};
use iroh_gossip::proto::TopicId;
use mailparse::dateparse;
use mailparse::headers::Headers;
use mailparse::MailHeaderMap;
@@ -744,15 +743,6 @@ pub(crate) fn strip_rtlo_characters(input_str: &str) -> String {
input_str.replace(|char| RTLO_CHARACTERS.contains(&char), "")
}
/// Generates a [TopicId] from some rfc724_mid.
pub(crate) fn get_topic_from_msg_id(rfc724_mid: &str) -> Result<TopicId> {
TopicId::from_str(&iroh_base::base32::fmt(
rfc724_mid
.get(0..32)
.context("Can't get 32 bytes from rfc724_mid")?,
))
}
#[cfg(test)]
mod tests {
#![allow(clippy::indexing_slicing)]