Compare commits

...

2 Commits

Author SHA1 Message Date
Zoltan Papp
ffeacd5e18 Fix key shortening function to handle short public keys 2025-08-05 00:31:32 +02:00
Zoltan Papp
f396277f91 Shorten peer public key in connection logs 2025-08-05 00:28:56 +02:00
2 changed files with 9 additions and 1 deletions

View File

@@ -127,7 +127,7 @@ func NewConn(config ConnConfig, services ServiceDependencies) (*Conn, error) {
return nil, fmt.Errorf("allowed IPs is empty")
}
connLog := log.WithField("peer", config.Key)
connLog := log.WithField("peer", shortenKey(config.Key))
var conn = &Conn{
Log: connLog,

View File

@@ -0,0 +1,8 @@
package peer
func shortenKey(pubKey string) string {
if len(pubKey) < 7 {
return pubKey
}
return pubKey[:7]
}