Add decentralized similarity routing
CI / check (push) Successful in 1m13s

This commit is contained in:
Aleksandr Bogomiakov
2026-08-10 19:35:35 +01:00
parent 6ceb52c5d2
commit f9a5096aea
15 changed files with 2017 additions and 14 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "federation-net"
version = "0.2.0"
version = "0.3.0"
description = "Generic peer-to-peer networking engine built on Iroh"
readme = "README.md"
documentation = "https://docs.rs/federation-net"
+10 -1
View File
@@ -8,7 +8,7 @@ use std::time::Duration;
use iroh::endpoint::{Connection, RecvStream, SendStream, VarInt, presets};
use iroh::protocol::{AcceptError, ProtocolHandler, Router};
use iroh::{Endpoint, EndpointAddr, EndpointId, SecretKey};
use iroh::{Endpoint, EndpointAddr, EndpointId, SecretKey, Signature};
use serde::Serialize;
use serde::de::DeserializeOwned;
use tokio::sync::{Semaphore, mpsc, watch};
@@ -1041,6 +1041,15 @@ impl<M: Message> NetworkEngine<M> {
self.shared.endpoint.id()
}
/// Signs application data with this peer's persistent transport identity.
///
/// The secret key never leaves the engine. Protocols can attach the
/// returned signature to records that may be forwarded by other peers;
/// recipients verify it against [`Self::endpoint_id`].
pub fn sign_identity(&self, message: &[u8]) -> Signature {
self.shared.endpoint.secret_key().sign(message)
}
/// Returns the network this engine participates in.
pub fn network_id(&self) -> NetworkId {
self.shared.config.network_id
+1 -1
View File
@@ -78,6 +78,6 @@ pub use ticket::{PeerTicket, TICKET_VERSION};
// Re-exported Iroh types that appear in the public API.
pub use iroh::endpoint::{RecvStream, SendStream};
pub use iroh::{EndpointAddr, EndpointId, SecretKey};
pub use iroh::{EndpointAddr, EndpointId, SecretKey, Signature};
// Re-exported so applications can use the generic ticket helpers.
pub use iroh_tickets::Ticket;