mirror of
https://github.com/status-im/status-go-monitor.git
synced 2025-01-12 12:24:36 +00:00
print shortened version of ID
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
c6b3fa3b9d
commit
fba5f56834
11
json.go
11
json.go
@ -4,7 +4,7 @@ import "fmt"
|
||||
|
||||
type Peer struct {
|
||||
Enode string `json:"enode"`
|
||||
Id string `json:"id"`
|
||||
Id peerId `json:"id"`
|
||||
Name string `json:"na"`
|
||||
Caps []string `json:"caps"`
|
||||
Network NetworkInfo `json:"netrowkr"`
|
||||
@ -15,6 +15,15 @@ func (p Peer) String() string {
|
||||
return fmt.Sprintf("Peer(id=%s)", p.Id)
|
||||
}
|
||||
|
||||
type peerId string
|
||||
|
||||
// the ID is too long to display in full in most places
|
||||
func (id peerId) String() string {
|
||||
return fmt.Sprintf("%s...%s",
|
||||
string(id[:6]),
|
||||
string(id[len(id)-6:]))
|
||||
}
|
||||
|
||||
type NetworkInfo struct {
|
||||
LocalAddress string `json:"localAddress"`
|
||||
RemoteAddress string `json:"remoteAddress"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user