pkg/mesh/mesh.go: use Equal func

Implement an Equal func for Enpoint and use it instead of comparing
strings.

Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
leonnicolas
2021-09-30 12:29:31 +02:00
parent 61ad16dea5
commit 16bb0491e2
3 changed files with 155 additions and 3 deletions

View File

@@ -660,7 +660,7 @@ func nodesAreEqual(a, b *Node) bool {
}
// Check the DNS name first since this package
// is doing the DNS resolution.
if a.Endpoint.StringOpt(true) != b.Endpoint.StringOpt(true) {
if !a.Endpoint.Equal(b.Endpoint, true) {
return false
}
// Ignore LastSeen when comparing equality we want to check if the nodes are
@@ -689,7 +689,7 @@ func peersAreEqual(a, b *Peer) bool {
}
// Check the DNS name first since this package
// is doing the DNS resolution.
if a.Endpoint.StringOpt(true) != b.Endpoint.StringOpt(true) {
if !a.Endpoint.Equal(b.Endpoint, true) {
return false
}
if len(a.AllowedIPs) != len(b.AllowedIPs) {