chore(routing): simplify default routes for loop
This commit is contained in:
@@ -31,7 +31,9 @@ func (r *Routing) DefaultRoutes() (defaultRoutes []DefaultRoute, err error) {
|
||||
}
|
||||
|
||||
for _, route := range routes {
|
||||
if route.Dst == nil {
|
||||
if route.Dst != nil {
|
||||
continue
|
||||
}
|
||||
defaultRoute := DefaultRoute{
|
||||
Gateway: route.Gw,
|
||||
Family: route.Family,
|
||||
@@ -55,7 +57,6 @@ func (r *Routing) DefaultRoutes() (defaultRoutes []DefaultRoute, err error) {
|
||||
r.logger.Info("default route found: " + defaultRoute.String())
|
||||
defaultRoutes = append(defaultRoutes, defaultRoute)
|
||||
}
|
||||
}
|
||||
|
||||
if len(defaultRoutes) == 0 {
|
||||
return nil, fmt.Errorf("%w: in %d route(s)", ErrRouteDefaultNotFound, len(routes))
|
||||
|
||||
Reference in New Issue
Block a user