]> Cypherpunks.ru repositories - govpn.git/commitdiff
Pretty print peer's identity in statistics
authorSergey Matveev <stargrave@stargrave.org>
Sat, 14 Nov 2015 16:16:03 +0000 (19:16 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 14 Nov 2015 16:16:03 +0000 (19:16 +0300)
Signed-off-by: Sergey Matveev <stargrave@stargrave.org>
src/govpn/identify.go

index 54c87d31e0117a300bab5a6b21fc4edd5aec1f01..b028b393f0bfce87c2d3fc6ad219378e4c6b7b83 100644 (file)
@@ -37,6 +37,10 @@ func (id PeerId) String() string {
        return hex.EncodeToString(id[:])
 }
 
+func (id PeerId) MarshalJSON() ([]byte, error) {
+       return []byte(`"` + id.String() + `"`), nil
+}
+
 type CipherCache struct {
        c map[PeerId]*xtea.Cipher
        l sync.RWMutex