Module udp

Module udp 

Source
Expand description

UdpNeighborDiscovery — cross-platform NDN neighbor discovery over UDP.

Works on Linux, macOS, Windows, Android, and iOS without any platform- specific code. Uses the IANA-assigned NDN multicast group (224.0.23.170:6363) for hello broadcasts and creates a unicast UdpFace per discovered peer.

§Protocol

Hello Interest (broadcast on the multicast face):

Name: /ndn/local/nd/hello/<nonce-u32>

Hello Data (reply via the multicast socket):

Name:    /ndn/local/nd/hello/<nonce-u32>
Content: HelloPayload TLV (NODE-NAME, SERVED-PREFIX*, CAPABILITIES?, NEIGHBOR-DIFF*)

When swim_indirect_fanout > 0, the protocol also handles:

  • /ndn/local/nd/probe/direct/<target>/<nonce> — respond with ACK if we are the target
  • /ndn/local/nd/probe/via/<us>/<target>/<nonce> — relay liveness check to target

§Usage

use ndn_discovery::UdpNeighborDiscovery;
use ndn_packet::Name;
use ndn_transport::FaceId;
use std::str::FromStr;

let node_name = Name::from_str("/ndn/site/mynode").unwrap();
let multicast_face_id = FaceId(1); // registered with engine beforehand

let nd = UdpNeighborDiscovery::new(multicast_face_id, node_name);
// Pass to EngineBuilder::discovery(nd)

Structs§

UdpMedium
UDP-specific link medium for HelloProtocol.

Type Aliases§

UdpNeighborDiscovery
UDP neighbor discovery — type alias for HelloProtocol<UdpMedium>.