mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-30 19:41:30 +02:00
minor fixes on diffs
This commit is contained in:
@@ -42,6 +42,7 @@ func (a *Account) GetPeerNetworkMapComponents(
|
||||
RoutersMap: make(map[string]map[string]*routerTypes.NetworkRouter),
|
||||
NetworkResources: make([]*resourceTypes.NetworkResource, 0),
|
||||
PostureFailedPeers: make(map[string]map[string]struct{}, len(a.PostureChecks)),
|
||||
RouterPeers: make(map[string]*nbpeer.Peer),
|
||||
}
|
||||
|
||||
components.AccountSettings = &AccountSettingsInfo{
|
||||
@@ -161,9 +162,12 @@ func (a *Account) GetPeerNetworkMapComponents(
|
||||
|
||||
components.RoutersMap[resource.NetworkID] = networkRoutingPeers
|
||||
for peerIDKey := range networkRoutingPeers {
|
||||
if _, exists := components.Peers[peerIDKey]; !exists {
|
||||
if _, validated := validatedPeersMap[peerIDKey]; validated {
|
||||
if p := a.Peers[peerIDKey]; p != nil {
|
||||
if p := a.Peers[peerIDKey]; p != nil {
|
||||
if _, exists := components.RouterPeers[peerIDKey]; !exists {
|
||||
components.RouterPeers[peerIDKey] = p
|
||||
}
|
||||
if _, exists := components.Peers[peerIDKey]; !exists {
|
||||
if _, validated := validatedPeersMap[peerIDKey]; validated {
|
||||
components.Peers[peerIDKey] = p
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ type NetworkMapComponents struct {
|
||||
GroupIDToUserIDs map[string][]string
|
||||
AllowedUserIDs map[string]struct{}
|
||||
PostureFailedPeers map[string]map[string]struct{}
|
||||
|
||||
RouterPeers map[string]*nbpeer.Peer
|
||||
}
|
||||
|
||||
type AccountSettingsInfo struct {
|
||||
@@ -54,6 +56,10 @@ func (c *NetworkMapComponents) GetPeerInfo(peerID string) *nbpeer.Peer {
|
||||
return c.Peers[peerID]
|
||||
}
|
||||
|
||||
func (c *NetworkMapComponents) GetRouterPeerInfo(peerID string) *nbpeer.Peer {
|
||||
return c.RouterPeers[peerID]
|
||||
}
|
||||
|
||||
func (c *NetworkMapComponents) GetGroupInfo(groupID string) *Group {
|
||||
return c.Groups[groupID]
|
||||
}
|
||||
@@ -479,6 +485,9 @@ func (calc *NetworkMapCalculator) getRoutesToSync(ctx context.Context, peerID st
|
||||
|
||||
func (calc *NetworkMapCalculator) getRoutingPeerRoutes(ctx context.Context, peerID string) (enabledRoutes []*route.Route, disabledRoutes []*route.Route) {
|
||||
peerInfo := calc.components.GetPeerInfo(peerID)
|
||||
if peerInfo == nil {
|
||||
peerInfo = calc.components.GetRouterPeerInfo(peerID)
|
||||
}
|
||||
if peerInfo == nil {
|
||||
return enabledRoutes, disabledRoutes
|
||||
}
|
||||
@@ -960,6 +969,9 @@ func (calc *NetworkMapCalculator) addNetworksRoutingPeers(
|
||||
|
||||
for p := range missingPeers {
|
||||
peerInfo := calc.components.GetPeerInfo(p)
|
||||
if peerInfo == nil {
|
||||
peerInfo = calc.components.GetRouterPeerInfo(p)
|
||||
}
|
||||
if peerInfo != nil {
|
||||
peersToConnect = append(peersToConnect, peerInfo)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user