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
Sourcepub async fn get_inbox_info(&self, inbox_id: &str) -> Result<Option<InboxInfo>>
pub async fn get_inbox_info(&self, inbox_id: &str) -> Result<Option<InboxInfo>>
Get inbox information
Sourcepub async fn remove_node(&self, peer_id: &PeerId) -> Result<()>
pub async fn remove_node(&self, peer_id: &PeerId) -> Result<()>
Remove a node from the DHT routing table
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DHT
impl !RefUnwindSafe for DHT
impl Send for DHT
impl Sync for DHT
impl Unpin for DHT
impl !UnwindSafe for DHT
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.