-
Notifications
You must be signed in to change notification settings - Fork 83
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
cmd: output all info in charon enr --verbose
#1250
cmd: output all info in charon enr --verbose
#1250
Conversation
Codecov ReportBase: 53.55% // Head: 53.57% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## xenowits/remove-p2p-address-defaults #1250 +/- ##
========================================================================
+ Coverage 53.55% 53.57% +0.01%
========================================================================
Files 139 139
Lines 16304 16260 -44
========================================================================
- Hits 8732 8711 -21
+ Misses 6306 6288 -18
+ Partials 1266 1261 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -109,3 +113,42 @@ func pubkeyHex(pubkey ecdsa.PublicKey) string { | |||
func bindEnrFlags(flags *pflag.FlagSet, verbose *bool) { | |||
flags.BoolVar(verbose, "verbose", false, "Prints the expanded form of ENR.") | |||
} | |||
|
|||
// enrNetworkingKeys returns a string containing the non-empty networking keys (ips and ports) present in the ENR record. | |||
func enrNetworkingKeys(r enr.Record) string { |
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.
does this work?
entries := []enr.Entry{
new(enr.IPv4),
new(enr.IPv6),
new(enr.TCP),
new(enr.TCP6),
new(enr.UDP),
new(enr.UDP6),
}
var sb strings.Builder
for _, entry := range entries {
if err := r.Load(entry); err == nil {
_, _ = sb.WriteString(fmt.Sprintf("%s: %v\n", entry.ENRKey(), entry))
}
}
return sb.String()
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.
It would produce an output like this:
***************** Decoded ENR (see https://enr-viewer.com/ for additional fields) **********************
secp256k1 pubkey: 0x3078303333636239396363306238363662323863343838303662343534633130343461303965353432626232306536623966333164346639653235353335613363353963
signature: 0xfefd8e3cb48b0a76c7134eac7fd4b7549f02f923c6c9490c0e4ff02074ab6a0208352ee2e7156955dd7147444c9f61bd805fa92fec16c55d5a35bb33c14bc336
seq: 0
id: v4
ip: &[127 0 0 1]
tcp: 0x140000161b8
udp: 0x140000161bc
********************************************************************************************************
since, some needs to be converted to strings while others are ints
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.
unfortunately it doesn't work. your approach seems quite concise though
Output all information pertaining to a decoded ENR for
charon enr --verbose
.category: feature
ticket: #998