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 {
|
type Peer struct {
|
||||||
Enode string `json:"enode"`
|
Enode string `json:"enode"`
|
||||||
Id string `json:"id"`
|
Id peerId `json:"id"`
|
||||||
Name string `json:"na"`
|
Name string `json:"na"`
|
||||||
Caps []string `json:"caps"`
|
Caps []string `json:"caps"`
|
||||||
Network NetworkInfo `json:"netrowkr"`
|
Network NetworkInfo `json:"netrowkr"`
|
||||||
|
@ -15,6 +15,15 @@ func (p Peer) String() string {
|
||||||
return fmt.Sprintf("Peer(id=%s)", p.Id)
|
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 {
|
type NetworkInfo struct {
|
||||||
LocalAddress string `json:"localAddress"`
|
LocalAddress string `json:"localAddress"`
|
||||||
RemoteAddress string `json:"remoteAddress"`
|
RemoteAddress string `json:"remoteAddress"`
|
||||||
|
|
Loading…
Reference in New Issue