5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-09 16:20:26 +00:00

skip multicast packets sent from our own key

This commit is contained in:
Arceliar 2021-06-13 12:31:52 -05:00
parent 1083131533
commit cb81be94ec

View File

@ -1,6 +1,7 @@
package multicast package multicast
import ( import (
"bytes"
"context" "context"
"crypto/ed25519" "crypto/ed25519"
"encoding/hex" "encoding/hex"
@ -350,6 +351,9 @@ func (m *Multicast) listen() {
} }
var key ed25519.PublicKey var key ed25519.PublicKey
key = append(key, bs[:ed25519.PublicKeySize]...) key = append(key, bs[:ed25519.PublicKeySize]...)
if bytes.Equal(key, m.core.GetSelf().Key) {
continue // don't bother trying to peer with self
}
anAddr := string(bs[ed25519.PublicKeySize:nBytes]) anAddr := string(bs[ed25519.PublicKeySize:nBytes])
addr, err := net.ResolveTCPAddr("tcp6", anAddr) addr, err := net.ResolveTCPAddr("tcp6", anAddr)
if err != nil { if err != nil {