(n *Nylon)
| 243 | } |
| 244 | |
| 245 | func buildRouteTables(n *Nylon) *protocol.RouteTables { |
| 246 | tables := &protocol.RouteTables{} |
| 247 | for _, route := range n.RouterState.Routes { |
| 248 | tables.Selected = append(tables.Selected, selRouteProto(route)) |
| 249 | } |
| 250 | slices.SortFunc(tables.Selected, func(a, b *protocol.SelRoute) int { |
| 251 | return comparePubRoute(a.PubRoute, b.PubRoute) |
| 252 | }) |
| 253 | for prefix, route := range n.router.ForwardTable.Load().All() { |
| 254 | tables.Forward = append(tables.Forward, &protocol.RouteTableEntry{ |
| 255 | Prefix: prefix.String(), |
| 256 | Nh: string(route.Nh), |
| 257 | Blackhole: route.Blackhole, |
| 258 | }) |
| 259 | } |
| 260 | sortRouteTableEntries(tables.Forward) |
| 261 | for prefix, route := range n.router.ExitTable.Load().All() { |
| 262 | tables.Exit = append(tables.Exit, &protocol.RouteTableEntry{ |
| 263 | Prefix: prefix.String(), |
| 264 | Nh: string(route.Nh), |
| 265 | Blackhole: route.Blackhole, |
| 266 | }) |
| 267 | } |
| 268 | sortRouteTableEntries(tables.Exit) |
| 269 | return tables |
| 270 | } |
| 271 | |
| 272 | func buildFeasibilityDistances(n *Nylon) []*protocol.FeasibilityDistance { |
| 273 | entries := make([]*protocol.FeasibilityDistance, 0, len(n.RouterState.Sources)) |
no test coverage detected