l1fe-weave-core · network::dht
Source declarations, signatures and documentation for network::dht.
Reviewed implementation boundary: Some core wrappers derive transport keys from DID strings. Do not infer secret key custody or authenticated peers from a supplied DID string; inspect the chosen wrapper and transport configuration. See /libraries/weave-core/overview.
Source: sigil/weave/libs/weave-core/src/network/dht.rs. SHA-256: d6704e766008326844fbaba6b4595307aee32cd4ed3d8435e2029da7fae09532.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
Module condition:
#[cfg(feature = "p2p")]network::dht::DhtConfig
DHT configuration
#[cfg(feature = "p2p")]
#[derive(Debug, Clone)]
pub struct DhtConfig {
/// Bootstrap nodes
pub bootstrap_nodes: Vec<Multiaddr>,
/// Local port
pub port: u16,
/// Replication factor
pub replication_factor: usize,
/// Record TTL
pub record_ttl: Duration
}Source line: 22.
network::dht::DhtStats
DHT statistics
#[cfg(feature = "p2p")]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DhtStats {
/// Number of connected peers
pub peer_count: usize,
/// Number of stored records
pub record_count: usize,
/// Bootstrap status
pub bootstrapped: bool,
/// Local peer ID
pub local_peer_id: String
}Source line: 46.
network::dht::ContentAnnouncement
Content announcement
#[cfg(feature = "p2p")]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ContentAnnouncement {
/// Content DID
pub did: String,
/// Provider peer ID
pub provider: String,
/// Metadata
pub metadata: Vec<u8>
}Source line: 59.
network::dht::Dht
DHT instance
#[cfg(feature = "p2p")]
pub struct Dht {
}Source line: 69.
network::dht::Dht::new
Create a new DHT instance for a given DID
Network keys are derived deterministically from the DID
#[cfg(feature = "p2p")]
pub fn new(config: DhtConfig, owner_did: Did) -> Result<Self>;Source line: 95.
network::dht::Dht::bootstrap
Bootstrap the DHT
#[cfg(feature = "p2p")]
pub async fn bootstrap(&self) -> Result<()>;Source line: 140.
network::dht::Dht::put
Store a record in the DHT
#[cfg(feature = "p2p")]
pub async fn put(&self, key: &str, value: Vec<u8>) -> Result<()>;Source line: 166.
network::dht::Dht::get
Get a record from the DHT
#[cfg(feature = "p2p")]
pub async fn get(&self, key: &str) -> Result<Option<Vec<u8>>>;Source line: 187.
network::dht::Dht::announce_content
Announce content availability
#[cfg(feature = "p2p")]
pub async fn announce_content(&self, content_did: &str, metadata: Vec<u8>) -> Result<()>;Source line: 222.
network::dht::Dht::find_content
Find content providers
#[cfg(feature = "p2p")]
pub async fn find_content(&self, content_did: &str) -> Result<Vec<ContentAnnouncement>>;Source line: 236.
network::dht::Dht::stats
Get DHT statistics
#[cfg(feature = "p2p")]
pub fn stats(&self) -> DhtStats;Source line: 248.
network::dht::Dht::peers
Get connected peers
#[cfg(feature = "p2p")]
pub fn peers(&self) -> Vec<(PeerId, Multiaddr)>;Source line: 253.
network::dht::Dht::local_peer_id
Get local peer ID
#[cfg(feature = "p2p")]
pub fn local_peer_id(&self) -> &PeerId;Source line: 261.
network::dht::Dht::owner_did
Get owner DID
#[cfg(feature = "p2p")]
pub fn owner_did(&self) -> &Did;Source line: 266.
network::dht::DhtBehaviour
DHT network behaviour for libp2p integration
#[cfg(feature = "p2p")]
pub struct DhtBehaviour {
}Source line: 272.
network::dht::DhtBehaviour::new
#[cfg(feature = "p2p")]
pub fn new(dht: &Dht) -> Self;Source line: 277.