Update peer.go

This commit is contained in:
Ocenka 2025-08-05 15:36:41 +01:00 committed by GitHub
parent 59405c40d3
commit 3765f28a1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -173,8 +173,9 @@ func (p *Peer) Fullname() string {
// Caps returns the capabilities (supported subprotocols) of the remote peer.
func (p *Peer) Caps() []Cap {
// TODO: maybe return copy
return p.rw.caps
capsCopy := make([]Cap, len(p.rw.caps))
copy(capsCopy, p.rw.caps)
return capsCopy
}
// RunningCap returns true if the peer is actively connected using any of the