Documentation / @super-line/adapter-libp2p / Discovery
Type Alias: Discovery
Discovery =
"mdns"| {mdns:MulticastDNSInit; } | {bootstrap:string[]; } | {dns:DnsDiscoveryInit; } | {relay:string|string[]; }
Defined in: packages/adapter-libp2p/src/index.ts:46
How the built-in node finds its peers. Strategies compose — pass an array to combine (e.g. mDNS on the LAN plus one cross-subnet seed).
'mdns'/{ mdns: opts }— multicast DNS on the local network (LANs, docker networks). Zero addresses to configure and no stable identity needed: peers re-find each other after restarts. The object form passes@libp2p/mdnsoptions through.{ bootstrap: [...] }— static seed multiaddrs (incl./p2p/<peerId>) dialed on startup. The classic fixed-seed topology.{ dns: { hostname, port } }— repeatedly resolves every A/AAAA record and dials each endpoint. Designed for Kubernetes headless Services and other dynamic DNS membership; no stable peer identity is needed.{ relay: addr }— multiaddr(s) of a circuit-relay-v2 node (run one with createRelayNode) for nodes that cannot reach each other directly (NAT). Adds WebSocket + circuit-relay transports, a/p2p-circuitlisten address, pubsub peer discovery on<topic>/_peer-discovery, and DCUtR so relayed links upgrade to direct connections where the network allows.