Skip to main content

Crate iroh_http_discovery

Crate iroh_http_discovery 

Source
Expand description

iroh-http-discovery — local mDNS peer discovery for iroh-http.

Implements standard DNS-SD (RFC 6763) mDNS so nodes on the same local network can find each other without a relay server.

Use browse_peers and advertise_peer to start discovery sessions.

§Wire format

Discovery speaks standard DNS-SD: advertising publishes PTR + SRV + TXT + A/AAAA records under _<service_name>._udp.local, with the service instance name set to the node’s base32 endpoint id and a pk TXT property carrying the same id. This is what Apple’s mDNSResponder (iOS NWBrowser) and Android’s NsdManager expect, so desktop nodes are discoverable from mobile — the previous swarm-discovery backend omitted the PTR record and was invisible to those browsers (issue #329).

§Platform notes

  • Desktop (macOS, Linux, Windows): enabled with the mdns feature (default).
  • iOS / Android (Tauri mobile): use the platform’s native service discovery.

Re-exports§

pub use engine::BrowseConfig;
pub use engine::Protocol;
pub use engine::ServiceConfig;
pub use engine::ServiceRecord;
pub use dns_sd::advertise;
pub use dns_sd::browse;
pub use dns_sd::AdvertiseSession;
pub use dns_sd::BrowseSession as ServiceBrowseSession;

Modules§

dns_sd
Generic DNS-SD (RFC 6763) advertise/browse engine.
engine
Platform-independent DNS-SD engine contracts.

Structs§

BrowseSession
PeerDiscoveryEvent
A discovery event suitable for FFI transport.

Enums§

DiscoveryError
Structured error returned by browse_peers and advertise_peer.

Constants§

TXT_ADDRESS
TXT property carrying direct ip:port addresses, if any.
TXT_PK
TXT property carrying the peer’s base32 endpoint id.
TXT_RELAY
TXT property carrying the peer’s home relay URL, if any.

Functions§

advertise_peer
Start advertising this node on the local network via DNS-SD.
browse_peers
Start a browse session: discover iroh-http peers on the local network.
browse_peers_with_engine
Project an already-started DNS-SD engine browse into an iroh endpoint.
peer_direct_addresses
Select every dialable direct candidate for an iroh peer.
peer_service_config_with_ips
Build the canonical DNS-SD advertisement for an iroh endpoint.