pub struct DHT {
pub skademlia: Option<SKademlia>,
pub ipv6_identity_manager: Option<IPv6DHTIdentityManager>,
/* private fields */
}
Expand description
Main DHT implementation with S/Kademlia security extensions
Fields§
§skademlia: Option<SKademlia>
S/Kademlia security extensions
ipv6_identity_manager: Option<IPv6DHTIdentityManager>
IPv6-based identity manager
Implementations§
Source§impl DHT
impl DHT
Sourcepub fn new_with_security(
local_id: Key,
config: DHTConfig,
skademlia_config: SKademliaConfig,
) -> Self
pub fn new_with_security( local_id: Key, config: DHTConfig, skademlia_config: SKademliaConfig, ) -> Self
Create a new DHT instance with S/Kademlia security extensions
Sourcepub fn new_with_ipv6_security(
local_id: Key,
config: DHTConfig,
skademlia_config: SKademliaConfig,
ipv6_config: IPv6DHTConfig,
) -> Self
pub fn new_with_ipv6_security( local_id: Key, config: DHTConfig, skademlia_config: SKademliaConfig, ipv6_config: IPv6DHTConfig, ) -> Self
Create a new DHT instance with full IPv6 security integration
Sourcepub fn set_local_ipv6_identity(&mut self, identity: IPv6NodeID) -> Result<()>
pub fn set_local_ipv6_identity(&mut self, identity: IPv6NodeID) -> Result<()>
Initialize local IPv6 identity
Sourcepub async fn add_bootstrap_node(
&self,
peer_id: PeerId,
addresses: Vec<Multiaddr>,
) -> Result<()>
pub async fn add_bootstrap_node( &self, peer_id: PeerId, addresses: Vec<Multiaddr>, ) -> Result<()>
Add a bootstrap node to the DHT
Sourcepub async fn add_ipv6_node(
&mut self,
peer_id: PeerId,
addresses: Vec<Multiaddr>,
ipv6_identity: IPv6NodeID,
) -> Result<()>
pub async fn add_ipv6_node( &mut self, peer_id: PeerId, addresses: Vec<Multiaddr>, ipv6_identity: IPv6NodeID, ) -> Result<()>
Add an IPv6-verified node to the DHT
Sourcepub async fn remove_ipv6_node(&mut self, peer_id: &PeerId) -> Result<()>
pub async fn remove_ipv6_node(&mut self, peer_id: &PeerId) -> Result<()>
Remove node with IPv6 cleanup
Sourcepub fn is_node_banned(&self, peer_id: &PeerId) -> bool
pub fn is_node_banned(&self, peer_id: &PeerId) -> bool
Check if node is banned due to IPv6 security violations
Sourcepub async fn put(&self, key: Key, value: Vec<u8>) -> Result<()>
pub async fn put(&self, key: Key, value: Vec<u8>) -> Result<()>
Store a record in the DHT with replication
Sourcepub async fn get(&self, key: &Key) -> Option<Record>
pub async fn get(&self, key: &Key) -> Option<Record>
Retrieve a record from the DHT with consistency checks
Sourcepub async fn handle_query(&self, query: DHTQuery) -> DHTResponse
pub async fn handle_query(&self, query: DHTQuery) -> DHTResponse
Handle incoming DHT query
Sourcepub async fn maintenance(&self) -> Result<()>
pub async fn maintenance(&self) -> Result<()>
Perform periodic maintenance
Sourcepub async fn secure_get(&mut self, key: &Key) -> Result<Option<Record>>
pub async fn secure_get(&mut self, key: &Key) -> Result<Option<Record>>
Perform secure lookup using S/Kademlia disjoint paths with distance verification
Sourcepub async fn secure_put(&mut self, key: Key, value: Vec<u8>) -> Result<()>
pub async fn secure_put(&mut self, key: Key, value: Vec<u8>) -> Result<()>
Store a record using S/Kademlia security-aware node selection
Sourcepub async fn update_sibling_list(&mut self, key: Key) -> Result<()>
pub async fn update_sibling_list(&mut self, key: Key) -> Result<()>
Update sibling lists for a key range
Sourcepub async fn validate_routing_consistency(&self) -> Result<ConsistencyReport>
pub async fn validate_routing_consistency(&self) -> Result<ConsistencyReport>
Validate routing table consistency using S/Kademlia
Sourcepub fn create_distance_challenge(
&mut self,
peer_id: &PeerId,
key: &Key,
) -> Option<DistanceChallenge>
pub fn create_distance_challenge( &mut self, peer_id: &PeerId, key: &Key, ) -> Option<DistanceChallenge>
Create a distance verification challenge for a peer
Sourcepub fn verify_distance_proof(&self, proof: &DistanceProof) -> Result<bool>
pub fn verify_distance_proof(&self, proof: &DistanceProof) -> Result<bool>
Verify a distance proof
Sourcepub fn create_enhanced_distance_challenge(
&mut self,
peer_id: &PeerId,
key: &Key,
suspected_attack: bool,
) -> Option<EnhancedDistanceChallenge>
pub fn create_enhanced_distance_challenge( &mut self, peer_id: &PeerId, key: &Key, suspected_attack: bool, ) -> Option<EnhancedDistanceChallenge>
Create enhanced distance challenge with adaptive difficulty
Sourcepub async fn verify_distance_multi_round(
&mut self,
challenge: &EnhancedDistanceChallenge,
) -> Result<bool>
pub async fn verify_distance_multi_round( &mut self, challenge: &EnhancedDistanceChallenge, ) -> Result<bool>
Verify distance using multi-round challenge protocol
Sourcepub fn get_security_bucket(&mut self, key: &Key) -> Option<&mut SecurityBucket>
pub fn get_security_bucket(&mut self, key: &Key) -> Option<&mut SecurityBucket>
Get security bucket for a key range
Sourcepub async fn add_trusted_node(
&mut self,
key: &Key,
peer_id: PeerId,
addresses: Vec<Multiaddr>,
) -> Result<()>
pub async fn add_trusted_node( &mut self, key: &Key, peer_id: PeerId, addresses: Vec<Multiaddr>, ) -> Result<()>
Add trusted node to security bucket
Sourcepub async fn ipv6_secure_get(&mut self, key: &Key) -> Result<Option<Record>>
pub async fn ipv6_secure_get(&mut self, key: &Key) -> Result<Option<Record>>
Perform IPv6-enhanced secure get operation
Sourcepub async fn ipv6_secure_put(&mut self, key: Key, value: Vec<u8>) -> Result<()>
pub async fn ipv6_secure_put(&mut self, key: Key, value: Vec<u8>) -> Result<()>
Perform IPv6-enhanced secure put operation
Sourcepub fn get_ipv6_diversity_stats(&self) -> Option<DiversityStats>
pub fn get_ipv6_diversity_stats(&self) -> Option<DiversityStats>
Get IPv6 diversity statistics
Sourcepub fn cleanup_ipv6_data(&mut self)
pub fn cleanup_ipv6_data(&mut self)
Cleanup expired IPv6 identities and reputation data
Sourcepub fn ban_ipv6_node(&mut self, peer_id: &PeerId, reason: &str)
pub fn ban_ipv6_node(&mut self, peer_id: &PeerId, reason: &str)
Ban a node for IPv6 security violations
Sourcepub fn get_local_ipv6_identity(&self) -> Option<&IPv6NodeID>
pub fn get_local_ipv6_identity(&self) -> Option<&IPv6NodeID>
Get local IPv6 identity
Sourcepub async fn check_consistency(&self, key: &Key) -> Result<ConsistencyReport>
pub async fn check_consistency(&self, key: &Key) -> Result<ConsistencyReport>
Check consistency of a record across multiple nodes
Sourcepub async fn repair_record(&self, key: &Key) -> Result<RepairResult>
pub async fn repair_record(&self, key: &Key) -> Result<RepairResult>
Repair inconsistencies for a specific key
Sourcepub async fn create_inbox(
&self,
inbox_id: &str,
owner_peer_id: PeerId,
) -> Result<InboxInfo>
pub async fn create_inbox( &self, inbox_id: &str, owner_peer_id: PeerId, ) -> Result<InboxInfo>
Create a new inbox for a user with infinite TTL
Sourcepub async fn send_message_to_inbox(
&self,
inbox_id: &str,
message: InboxMessage,
) -> Result<()>
pub async fn send_message_to_inbox( &self, inbox_id: &str, message: InboxMessage, ) -> Result<()>
Send a message to an inbox
Sourcepub async fn get_inbox_messages(
&self,
inbox_id: &str,
limit: Option<usize>,
) -> Result<Vec<InboxMessage>>
pub async fn get_inbox_messages( &self, inbox_id: &str, limit: Option<usize>, ) -> Result<Vec<InboxMessage>>
Get messages from an inbox