add suggestions from review

Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
leonnicolas
2021-09-30 12:03:00 +02:00
parent c7e2be9357
commit 61ad16dea5
7 changed files with 41 additions and 18 deletions

View File

@@ -542,7 +542,7 @@ func (m *Mesh) applyTopology() {
equal, diff := conf.Equal(wgDevice)
if !equal {
level.Info(m.logger).Log("msg", "WireGuard configurations are different", "diff", diff)
level.Debug(m.logger).Log("changing wg config", "config", conf.WGConfig())
level.Debug(m.logger).Log("msg", "changing wg config", "config", conf.WGConfig())
if err := wgClient.ConfigureDevice(m.kiloIfaceName, conf.WGConfig()); err != nil {
level.Error(m.logger).Log("error", err)
m.errorCounter.WithLabelValues("apply").Inc()
@@ -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(false) != b.Endpoint.StringOpt(false) {
if a.Endpoint.StringOpt(true) != b.Endpoint.StringOpt(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(false) != b.Endpoint.StringOpt(false) {
if a.Endpoint.StringOpt(true) != b.Endpoint.StringOpt(true) {
return false
}
if len(a.AllowedIPs) != len(b.AllowedIPs) {