go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

Query: Where is the bootstrap package in the latest version?

Open paulwizviz opened this issue 1 year ago • 3 comments

I am new to the library. I was told there is a bootstrap package to support bootstrap-based discovery.

paulwizviz avatar May 20 '24 13:05 paulwizviz

I think you are looking for go-libp2p-kad-dht Here is the bootstrap peers option for it: https://github.com/libp2p/go-libp2p-kad-dht/blob/master/dht_options.go#L275

For mdns based discovery look at https://pkg.go.dev/github.com/libp2p/go-libp2p/p2p/discovery/mdns

sukunrt avatar May 20 '24 15:05 sukunrt

I think you are looking for go-libp2p-kad-dht Here is the bootstrap peers option for it: https://github.com/libp2p/go-libp2p-kad-dht/blob/master/dht_options.go#L275

For mdns based discovery look at https://pkg.go.dev/github.com/libp2p/go-libp2p/p2p/discovery/mdns

I think you are looking for go-libp2p-kad-dht Here is the bootstrap peers option for it: https://github.com/libp2p/go-libp2p-kad-dht/blob/master/dht_options.go#L275

For mdns based discovery look at https://pkg.go.dev/github.com/libp2p/go-libp2p/p2p/discovery/mdns

I was looking at an example code that references this "github.com/libp2p/go-libp2p/p2p/discovery/routing". But I can't find it in that latest version.

This is what I was trying to do.

    bootstrapConfig := bootstrap.BootstrapConfigWithPeers([]peer.AddrInfo{*bootstrapPeer})
    bootstrapService, err := bootstrap.NewBootstrapService(ctx, h, bootstrapConfig)
    if err != nil {
        log.Fatal(err)
    }

    // Start the bootstrap service
    if err := bootstrapService.Start(); err != nil {
        log.Fatal(err)
    }

However, I could not find that package in the go-libp2p module. I would like to test a scenario where peers could be found on a WAN or the Internet. I understand libp2p DHT can achieve this. Is that correct?

paulwizviz avatar May 20 '24 15:05 paulwizviz

@paulwizviz I think you are looking for https://github.com/ipfs/boxo/blob/main/bootstrap/bootstrap.go Docs: https://pkg.go.dev/github.com/ipfs/[email protected]/bootstrap

gammazero avatar Jul 30 '24 08:07 gammazero