mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-23 22:09:09 +02:00
fix linter issues
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
@@ -98,14 +98,6 @@ func NewController(ctx context.Context, store store.Store, metrics telemetry.App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseBoolEnv reads an env var via strconv.ParseBool so callers accept the
|
|
||||||
// usual "1/t/T/TRUE/true/True" set instead of being strict about a single
|
|
||||||
// literal.
|
|
||||||
func parseBoolEnv(key string) bool {
|
|
||||||
v, _ := strconv.ParseBool(os.Getenv(key))
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Controller) OnPeerConnected(ctx context.Context, accountID string, peerID string) (chan *network_map.UpdateMessage, error) {
|
func (c *Controller) OnPeerConnected(ctx context.Context, accountID string, peerID string) (chan *network_map.UpdateMessage, error) {
|
||||||
peer, err := c.repo.GetPeerByID(ctx, accountID, peerID)
|
peer, err := c.repo.GetPeerByID(ctx, accountID, peerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -252,7 +244,7 @@ func (c *Controller) sendUpdateAccountPeers(ctx context.Context, accountID strin
|
|||||||
// the client merges it into Calculate()'s output the same
|
// the client merges it into Calculate()'s output the same
|
||||||
// way the legacy server did via NetworkMap.Merge.
|
// way the legacy server did via NetworkMap.Merge.
|
||||||
update = grpc.ToComponentSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, components, proxyNetworkMap, dnsDomain, postureChecks, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
update = grpc.ToComponentSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, components, proxyNetworkMap, dnsDomain, postureChecks, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
||||||
|
c.metrics.CountToSyncResponseDuration(time.Since(start))
|
||||||
} else {
|
} else {
|
||||||
nmap := account.GetPeerNetworkMapFromComponents(
|
nmap := account.GetPeerNetworkMapFromComponents(
|
||||||
ctx, p.ID, peersCustomZone, accountZones, approvedPeersMap, resourcePolicies, routers, c.accountManagerMetrics, groupIDToUserIDs)
|
ctx, p.ID, peersCustomZone, accountZones, approvedPeersMap, resourcePolicies, routers, c.accountManagerMetrics, groupIDToUserIDs)
|
||||||
@@ -265,10 +257,9 @@ func (c *Controller) sendUpdateAccountPeers(ctx context.Context, accountID strin
|
|||||||
|
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
update = grpc.ToSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, nmap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
update = grpc.ToSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, nmap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
||||||
|
c.metrics.CountToSyncResponseDuration(time.Since(start))
|
||||||
}
|
}
|
||||||
|
|
||||||
c.metrics.CountToSyncResponseDuration(time.Since(start))
|
|
||||||
|
|
||||||
c.peersUpdateManager.SendUpdate(ctx, p.ID, &network_map.UpdateMessage{
|
c.peersUpdateManager.SendUpdate(ctx, p.ID, &network_map.UpdateMessage{
|
||||||
Update: update,
|
Update: update,
|
||||||
MessageType: network_map.MessageTypeNetworkMap,
|
MessageType: network_map.MessageTypeNetworkMap,
|
||||||
@@ -404,7 +395,7 @@ func (c *Controller) sendUpdateForAffectedPeers(ctx context.Context, accountID s
|
|||||||
// the client merges it into Calculate()'s output the same
|
// the client merges it into Calculate()'s output the same
|
||||||
// way the legacy server did via NetworkMap.Merge.
|
// way the legacy server did via NetworkMap.Merge.
|
||||||
update = grpc.ToComponentSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, components, proxyNetworkMap, dnsDomain, postureChecks, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
update = grpc.ToComponentSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, components, proxyNetworkMap, dnsDomain, postureChecks, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
||||||
|
c.metrics.CountToSyncResponseDuration(time.Since(start))
|
||||||
} else {
|
} else {
|
||||||
nmap := account.GetPeerNetworkMapFromComponents(
|
nmap := account.GetPeerNetworkMapFromComponents(
|
||||||
ctx, p.ID, peersCustomZone, accountZones, approvedPeersMap, resourcePolicies, routers, c.accountManagerMetrics, groupIDToUserIDs)
|
ctx, p.ID, peersCustomZone, accountZones, approvedPeersMap, resourcePolicies, routers, c.accountManagerMetrics, groupIDToUserIDs)
|
||||||
@@ -417,6 +408,7 @@ func (c *Controller) sendUpdateForAffectedPeers(ctx context.Context, accountID s
|
|||||||
|
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
update = grpc.ToSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, nmap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
update = grpc.ToSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, nmap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
|
||||||
|
c.metrics.CountToSyncResponseDuration(time.Since(start))
|
||||||
}
|
}
|
||||||
|
|
||||||
c.peersUpdateManager.SendUpdate(ctx, p.ID, &network_map.UpdateMessage{
|
c.peersUpdateManager.SendUpdate(ctx, p.ID, &network_map.UpdateMessage{
|
||||||
|
|||||||
Reference in New Issue
Block a user