-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
p2p/enode: improve IPv6 support, add ENR text representation #19663
Conversation
This adds entry types for "ip6", "udp6", "tcp6" keys. The IP type stays around because removing it would break a lot of code and force everyone to care about the distinction. I also added a Signature method for completeness' sake.
LocalNode predicts the local node's UDP endpoint and updates the record. This change makes it predict IPv4 and IPv6 endpoints separately since they can now be in the record at the same time.
This allows passing base64-encoded node records to all the places that previously accepted enode:// URLs. The URL format is still supported.
...and return the base64 record in NodeInfo.
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.
Tested the Whisper stuff with IPV4, works fine.
@@ -747,9 +747,9 @@ func requestExpiredMessagesLoop() { | |||
} | |||
|
|||
func extractIDFromEnode(s string) []byte { | |||
n, err := enode.ParseV4(s) |
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.
Quick reminder to also change the NodeInfo().Enode
on line 302
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.
LGTM + tests pass on Windows
This PR adapts p2p/enr and p2p/enode to the final version of EIP-778 (ethereum/EIPs#2097). It also changes all invocations of enode.ParseV4 to enode.Parse, allowing signed ENRs to be set as bootnodes and static peers.