libp2p.discovery.bootstrap package

Submodules

Module contents

Bootstrap peer discovery module for py-libp2p.

class libp2p.discovery.bootstrap.BootstrapDiscovery(swarm: INetworkService, bootstrap_addrs: list[str])

Bases: object

Bootstrap-based peer discovery for py-libp2p. Connects to predefined bootstrap peers and adds them to peerstore.

async add_addr(peer_info: PeerInfo) None

Add a peer to the peerstore, emit discovery event, and attempt connection in parallel.

is_dns_addr(addr: Multiaddr) bool

Check if the address is a DNS address.

async start() None

Process bootstrap addresses and emit peer discovery events in parallel.

stop() None

Clean up bootstrap discovery resources.