This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 112
all:bzzaddr instead of just overlay for logging #2000
Merged
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d7beb3a
use bzzaddr instead of just overlay for logging
pradovic f555d0a
go fmt
pradovic 492493f
fixed linting errors
pradovic a956e63
handle nil and bad values in network.ShortString()
pradovic cb0751b
ommit unnecessary slicing
pradovic f9317e8
added use of bzzaddr for logging wherever easily possible
pradovic b243efe
go fmt
pradovic f4d2c61
fix linting
pradovic 09aa7b5
fixed bzzaddr test intialization
pradovic d1c9387
fixed inspector tests
pradovic 9faf4cd
fixed inspector properly
pradovic 0343a0d
added comments
pradovic 5cb4bf3
minor test fixes
pradovic afb712e
few more minor logs change
pradovic 1164e20
minor cosmetic changes
pradovic 45c2834
comments fix
pradovic a5b0aeb
minor comments fix
pradovic 1613806
merge with master
pradovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package network | |
|
||
import ( | ||
"crypto/ecdsa" | ||
"encoding/hex" | ||
"fmt" | ||
"io" | ||
"net" | ||
|
@@ -90,6 +91,28 @@ func (a *BzzAddr) Under() []byte { | |
return a.UAddr | ||
} | ||
|
||
// ShortString prints beginning of the OAddr and UAddr | ||
// It can be used for id in logging | ||
func (a *BzzAddr) ShortString() string { | ||
return fmt.Sprintf("%s:%s", a.ShortOver(), a.ShortUnder()) | ||
} | ||
|
||
func (a *BzzAddr) ShortOver() string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment exported functions |
||
if oaddr := hex.EncodeToString(a.OAddr); len(oaddr) >= 16 { | ||
return oaddr[:16] | ||
} else { | ||
return oaddr | ||
} | ||
} | ||
|
||
func (a *BzzAddr) ShortUnder() string { | ||
if uaddr := hex.EncodeToString(a.UAddr); len(uaddr) >= 16 { | ||
return uaddr[:16] | ||
} else { | ||
return uaddr | ||
} | ||
} | ||
|
||
// ID returns the node identifier in the underlay. | ||
func (a *BzzAddr) ID() enode.ID { | ||
n, err := enode.ParseV4(string(a.UAddr)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just an idea, for the underlay address, to use
nil
instead, not to present an example where overlay address is used as a value from underlay?The same question stands for other places where NewBzzAddr is used with identical value for arguments.
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.
I agree, I started to change this on the whole project but did not push yet :) Thanks!
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.
Actually, this concrete case needs underlay address because of the
PeerInfo()
function, so I have decided to create another rand key for peer base address. I know it's not needed, but I think it gives more info in tests about the nature of address. WDYT?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.
Or maybe just to add a comment justifying the usage of baseKey in this particular case. That would be also good, at least for me.