MCPcopy
hub / github.com/netbirdio/netbird / executeRouteToggle

Function executeRouteToggle

client/android/route_command.go:15–34  ·  view source on GitHub ↗
(id string, manager routemanager.Manager,
	operationName string,
	routeOperation func(routes []route.NetID, allRoutes []route.NetID) error)

Source from the content-addressed store, hash-verified

13)
14
15func executeRouteToggle(id string, manager routemanager.Manager,
16 operationName string,
17 routeOperation func(routes []route.NetID, allRoutes []route.NetID) error) error {
18 netID := route.NetID(id)
19 routes := []route.NetID{netID}
20
21 routesMap := manager.GetClientRoutesWithNetID()
22 routes = route.ExpandV6ExitPairs(routes, routesMap)
23
24 log.Debugf("%s with ids: %v", operationName, routes)
25
26 if err := routeOperation(routes, maps.Keys(routesMap)); err != nil {
27 log.Debugf("error when %s: %s", operationName, err)
28 return fmt.Errorf("error %s: %w", operationName, err)
29 }
30
31 manager.TriggerSelection(manager.GetClientRoutes())
32
33 return nil
34}
35
36type routeCommand interface {
37 toggleRoute() error

Callers 2

toggleRouteMethod · 0.85
toggleRouteMethod · 0.85

Calls 7

NetIDTypeAlias · 0.92
ExpandV6ExitPairsFunction · 0.92
ErrorfMethod · 0.80
DebugfMethod · 0.65
TriggerSelectionMethod · 0.65
GetClientRoutesMethod · 0.65

Tested by

no test coverage detected