-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade DHT version #479
Upgrade DHT version #479
Conversation
d9307e1
to
4c17e75
Compare
74ca902
to
d7523e1
Compare
13bf3de
to
bf603e0
Compare
5577ec7
to
a65ba4e
Compare
bf603e0
to
1a4490b
Compare
Changed base to cypress. |
@aschmahmann Thanks for the brilliant offline explanation of why we need all this & how it all works. Just some comments requesting documentation to explain this to new code-readers who might not be well versed in the subtleties involved in protocol upgrades. |
1a4490b
to
0f3efa4
Compare
…e logic in a single location. add comments explaining that we only want to add peers speaking primary protocols in our routing tables.
…e primary protocols
…ons, left implemented and deprecated in options package
if only { | ||
return dht.Mode(dht.ModeClient) | ||
} | ||
return dht.Mode(dht.ModeAuto) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is making the default here ModeAuto instead of doing nothing when only ==false
ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore my only comment, we can handle that in a future patch.
protocols []protocol.ID | ||
|
||
// DHT protocols we can respond to (may contain protocols in addition to the primary protocols) | ||
serverProtocols []protocol.ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably also need kad1Protocol
and kad2Protocol
for figuring out how we should respond to peers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM, we can tackle that once we actually have different protocol handlers to use (hopefully won't be too long 🙏)
* upgraded the protocol id to version 2 (i.e. /kad/2.0.0) and made it so v2 peers running in server mode respond to queries from v1 peers. Note: v2 peers will only send queries using the v2 protocol, will only add v2 peers to their routing tables, and will only tell v1 peers about v2 peers. * to run a forked network we now use network specific protocol prefixes instead of manually setting protocol IDs. Use the ProtocolPrefix option instead of the Protocols option. * emit errors during initialization if the user misuses the default protocol prefix by setting parameters inconsistent with the default protocol's network specification * since the Client option has been deprecated it's been removed from the dht's options. While deprecated it is still available in the dht options package. Setting `Client(false)` now puts the node into ModeAuto.
* upgraded the protocol id to version 2 (i.e. /kad/2.0.0) and made it so v2 peers running in server mode respond to queries from v1 peers. Note: v2 peers will only send queries using the v2 protocol, will only add v2 peers to their routing tables, and will only tell v1 peers about v2 peers. * to run a forked network we now use network specific protocol prefixes instead of manually setting protocol IDs. Use the ProtocolPrefix option instead of the Protocols option. * emit errors during initialization if the user misuses the default protocol prefix by setting parameters inconsistent with the default protocol's network specification * since the Client option has been deprecated it's been removed from the dht's options. While deprecated it is still available in the dht options package. Setting `Client(false)` now puts the node into ModeAuto.
Relates to libp2p/go-libp2p#780
Is currently targeted as merging into
feat/mode-switching
, but after #469 is merged this PR will be redirected to merge ontocypress