Struct DHT

Source
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

Source

pub fn new(local_id: Key, config: DHTConfig) -> Self

Create a new DHT instance

Source

pub fn new_with_security( local_id: Key, config: DHTConfig, skademlia_config: SKademliaConfig, ) -> Self

Create a new DHT instance with S/Kademlia security extensions

Source

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

Source

pub fn set_local_ipv6_identity(&mut self, identity: IPv6NodeID) -> Result<()>

Initialize local IPv6 identity

Source

pub async fn add_bootstrap_node( &self, peer_id: PeerId, addresses: Vec<Multiaddr>, ) -> Result<()>

Add a bootstrap node to the DHT

Source

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

Source

pub async fn remove_ipv6_node(&mut self, peer_id: &PeerId) -> Result<()>

Remove node with IPv6 cleanup

Source

pub fn is_node_banned(&self, peer_id: &PeerId) -> bool

Check if node is banned due to IPv6 security violations

Source

pub async fn put(&self, key: Key, value: Vec<u8>) -> Result<()>

Store a record in the DHT with replication

Source

pub async fn get(&self, key: &Key) -> Option<Record>

Retrieve a record from the DHT with consistency checks

Source

pub async fn find_node(&self, key: &Key) -> Vec<DHTNode>

Find nodes close to a key

Source

pub async fn handle_query(&self, query: DHTQuery) -> DHTResponse

Handle incoming DHT query

Source

pub async fn stats(&self) -> DHTStats

Get DHT statistics

Source

pub async fn maintenance(&self) -> Result<()>

Perform periodic maintenance

Source

pub async fn secure_get(&mut self, key: &Key) -> Result<Option<Record>>

Perform secure lookup using S/Kademlia disjoint paths with distance verification

Source

pub async fn secure_put(&mut self, key: Key, value: Vec<u8>) -> Result<()>

Store a record using S/Kademlia security-aware node selection

Source

pub async fn update_sibling_list(&mut self, key: Key) -> Result<()>

Update sibling lists for a key range

Source

pub async fn validate_routing_consistency(&self) -> Result<ConsistencyReport>

Validate routing table consistency using S/Kademlia

Source

pub fn create_distance_challenge( &mut self, peer_id: &PeerId, key: &Key, ) -> Option<DistanceChallenge>

Create a distance verification challenge for a peer

Source

pub fn verify_distance_proof(&self, proof: &DistanceProof) -> Result<bool>

Verify a distance proof

Source

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

Source

pub async fn verify_distance_multi_round( &mut self, challenge: &EnhancedDistanceChallenge, ) -> Result<bool>

Verify distance using multi-round challenge protocol

Source

pub fn get_security_bucket(&mut self, key: &Key) -> Option<&mut SecurityBucket>

Get security bucket for a key range

Source

pub async fn add_trusted_node( &mut self, key: &Key, peer_id: PeerId, addresses: Vec<Multiaddr>, ) -> Result<()>

Add trusted node to security bucket

Source

pub async fn ipv6_secure_get(&mut self, key: &Key) -> Result<Option<Record>>

Perform IPv6-enhanced secure get operation

Source

pub async fn ipv6_secure_put(&mut self, key: Key, value: Vec<u8>) -> Result<()>

Perform IPv6-enhanced secure put operation

Source

pub fn get_ipv6_diversity_stats(&self) -> Option<DiversityStats>

Get IPv6 diversity statistics

Source

pub fn cleanup_ipv6_data(&mut self)

Cleanup expired IPv6 identities and reputation data

Source

pub fn ban_ipv6_node(&mut self, peer_id: &PeerId, reason: &str)

Ban a node for IPv6 security violations

Source

pub fn get_local_ipv6_identity(&self) -> Option<&IPv6NodeID>

Get local IPv6 identity

Source

pub async fn check_consistency(&self, key: &Key) -> Result<ConsistencyReport>

Check consistency of a record across multiple nodes

Source

pub async fn repair_record(&self, key: &Key) -> Result<RepairResult>

Repair inconsistencies for a specific key

Source

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

Source

pub async fn send_message_to_inbox( &self, inbox_id: &str, message: InboxMessage, ) -> Result<()>

Send a message to an inbox

Source

pub async fn get_inbox_messages( &self, inbox_id: &str, limit: Option<usize>, ) -> Result<Vec<InboxMessage>>

Get messages from an inbox

Source

pub async fn get_inbox_info(&self, inbox_id: &str) -> Result<Option<InboxInfo>>

Get inbox information

Trait Implementations§

Source§

impl Debug for DHT

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,