Skip to content

Instantly share code, notes, and snippets.

@anacrolix
Created January 28, 2019 03:24
Show Gist options
  • Save anacrolix/dffcf869275be855d8d122e41c1e42bb to your computer and use it in GitHub Desktop.
Save anacrolix/dffcf869275be855d8d122e41c1e42bb to your computer and use it in GitHub Desktop.
zenground0 [2:07 PM]
The first one is whether a libp2p host will advertise its (pid, multiaddr) mapping in a networks' DHT after constructing the node with a `libp2p.Routing(makeDHT)` option.
Right now this is all we do in the filecoin network and we don't seem to be advertising id,addr records in the dht.
Wondering if we're missing an obvious `provideRouteToMe` call or something like that
anacrolix [2:11 PM]
I’ll have to check, but a typical DHT will routinely reestablish its own presence to nearby peers, and announce itself during bootstraps.
In the context of libp2p, that should include the peer ID and routing information like multiaddrs
zenground0 [2:12 PM]
and the bootstrap process should be happening automatically when the host is constructed?
anacrolix [2:14 PM]
I believe the existing implementation breaks it unconventionally into two steps: filling the host connection cache with connections to the bootstrap nodes, and then manually calling Bootstrap on the DHT instance to make it walk the network at regular intervals.
So I’d also have to check if that second part is automatically, I don’t think it is. The first part we will fix to require action directly on the routing table to allow resuming previous routing table states, and avoid hammering bootstrap nodes.
is automatic*
I’m still poking through the codebase, it deviates significantly from a typical implementation.
zenground0 [2:18 PM]
thanks this is really helpful. sounds like a good place to start digging into. Do you have an entry point for the manual bootstrap call? I'm github searching bootstrap in go-libp2p-kad-dht and not seeing anything that quite matches what I thought I'd find.
actually scratch that
github search is just very bad
anacrolix [2:20 PM]
yeah this is the best example there is at the moment: https://github.com/libp2p/go-libp2p-examples/blob/master/chat-with-rendezvous/chat.go#L126-L145
i’m working on a tool to directly interact with the dht without going through the ipfs command, which should track the API closely
zenground0 [2:20 PM]
oh thanks great example
That tool sounds like the answer to my second question
Is there a repo I can follow to look at that work?
anacrolix [2:22 PM]
i can push a branch at some point, but it’s not useful to anyone else at the moment
zenground0 [2:23 PM]
ok gotcha. Out of curiosity which repo is the branch in?
anacrolix [2:24 PM]
`provideRouteToMe` would be the FindPeers(self) method on a normal implementation, but due to the way the host’s connection manager is coupled to the DHT routing table at the moment, it won’t be very helpful to you. `Bootstrap` is the next closest, but it currently just calls `FindPeer` on regular intervals.
it’ll be in libp2p/go-libp2p-kad-dht
zenground0 [2:25 PM]
thanks @anacrolix this has been super helpful
anacrolix [2:26 PM]
no problem. submit issues on github against go-libp2p-kad-dht if you require something specific
zenground0 [2:26 PM]
alright, try to stay cool
I'm guessing you have practice tho :slightly_smiling_face:
anacrolix [2:27 PM]
:snowman_without_snow:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment