[client] Ignore irrelevant route changes to tracked network monitor routes (#3796)

This commit is contained in:
Viktor Liu
2025-05-09 14:01:21 +02:00
committed by GitHub
parent cad2fe1f39
commit d5b52e86b6
6 changed files with 464 additions and 29 deletions

View File

@ -1,6 +1,7 @@
package systemops
import (
"fmt"
"net"
"net/netip"
"sync"
@ -15,6 +16,20 @@ type Nexthop struct {
Intf *net.Interface
}
// Equal checks if two nexthops are equal.
func (n Nexthop) Equal(other Nexthop) bool {
return n.IP == other.IP && (n.Intf == nil && other.Intf == nil ||
n.Intf != nil && other.Intf != nil && n.Intf.Index == other.Intf.Index)
}
// String returns a string representation of the nexthop.
func (n Nexthop) String() string {
if n.Intf == nil {
return n.IP.String()
}
return fmt.Sprintf("%s @ %d (%s)", n.IP.String(), n.Intf.Index, n.Intf.Name)
}
type ExclusionCounter = refcounter.Counter[netip.Prefix, struct{}, Nexthop]
type SysOps struct {