1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 09:15:14 +01:00

Prettier abbreviation

This commit is contained in:
Jason A. Donenfeld 2018-05-13 23:27:28 +02:00
parent b56af1829d
commit e21ea58db3

View File

@ -147,7 +147,7 @@ func (peer *Peer) String() string {
base64Key := base64.StdEncoding.EncodeToString(peer.handshake.remoteStatic[:]) base64Key := base64.StdEncoding.EncodeToString(peer.handshake.remoteStatic[:])
abbreviatedKey := "invalid" abbreviatedKey := "invalid"
if len(base64Key) == 44 { if len(base64Key) == 44 {
abbreviatedKey = base64Key[0:4] + "..." + base64Key[40:44] abbreviatedKey = base64Key[0:4] + "…" + base64Key[39:43]
} }
return fmt.Sprintf("peer(%s)", abbreviatedKey) return fmt.Sprintf("peer(%s)", abbreviatedKey)
} }