Refactor route handling to use RouteWithResourceId for improved state management

This commit is contained in:
Hakan Sariman
2025-03-07 18:43:49 +03:00
parent de3b5c78d7
commit 54d0591833
4 changed files with 19 additions and 8 deletions
+1 -1
View File
@@ -619,7 +619,7 @@ func seedFromStatus(a *anonymize.Anonymizer, status *peer.FullStatus) {
}
for route := range status.LocalPeerState.Routes {
a.AnonymizeRoute(route)
a.AnonymizeRoute(route.Route)
}
for _, nsGroup := range status.NSGroupStates {
+7 -2
View File
@@ -11,7 +11,6 @@ import (
"time"
"github.com/cenkalti/backoff/v4"
"golang.org/x/exp/maps"
"google.golang.org/protobuf/types/known/durationpb"
log "github.com/sirupsen/logrus"
@@ -803,13 +802,19 @@ func toProtoFullStatus(fullStatus peer.FullStatus) *proto.FullStatus {
pbFullStatus.SignalState.Error = err.Error()
}
localState := fullStatus.LocalPeerState.Clone()
var routesSlice []string
for route := range localState.Routes {
routesSlice = append(routesSlice, route.Route)
}
pbFullStatus.LocalPeerState.IP = fullStatus.LocalPeerState.IP
pbFullStatus.LocalPeerState.PubKey = fullStatus.LocalPeerState.PubKey
pbFullStatus.LocalPeerState.KernelInterface = fullStatus.LocalPeerState.KernelInterface
pbFullStatus.LocalPeerState.Fqdn = fullStatus.LocalPeerState.FQDN
pbFullStatus.LocalPeerState.RosenpassPermissive = fullStatus.RosenpassState.Permissive
pbFullStatus.LocalPeerState.RosenpassEnabled = fullStatus.RosenpassState.Enabled
pbFullStatus.LocalPeerState.Networks = maps.Keys(fullStatus.LocalPeerState.Routes)
pbFullStatus.LocalPeerState.Networks = routesSlice
pbFullStatus.NumberOfForwardingRules = int32(fullStatus.NumOfForwardingRules)
for _, peerState := range fullStatus.Peers {