(neigh *state.Neighbour)
| 205 | } |
| 206 | |
| 207 | func buildEndpoints(neigh *state.Neighbour) []*protocol.EndpointInfo { |
| 208 | eps := make([]*protocol.EndpointInfo, 0, len(neigh.Eps)) |
| 209 | for _, ep := range neigh.Eps { |
| 210 | nep := ep.AsNylonEndpoint() |
| 211 | var resolved *string |
| 212 | if ap, err := nep.DynEP.Get(); err == nil { |
| 213 | resolved = stringPtr(ap.String()) |
| 214 | } |
| 215 | eps = append(eps, &protocol.EndpointInfo{ |
| 216 | Address: nep.DynEP.Value, |
| 217 | Resolved: resolved, |
| 218 | Active: ep.IsActive(), |
| 219 | RemoteInit: ep.IsRemote(), |
| 220 | Metric: ep.Metric(), |
| 221 | FilteredRttNs: int64(nep.FilteredPing()), |
| 222 | StabilizedRttNs: int64(nep.StabilizedPing()), |
| 223 | }) |
| 224 | } |
| 225 | slices.SortFunc(eps, func(a, b *protocol.EndpointInfo) int { |
| 226 | if cmpMetric := cmp.Compare(a.Metric, b.Metric); cmpMetric != 0 { |
| 227 | return cmpMetric |
| 228 | } |
| 229 | return cmp.Compare(a.Address, b.Address) |
| 230 | }) |
| 231 | return eps |
| 232 | } |
| 233 | |
| 234 | func buildNeighRoutes(neigh *state.Neighbour) []*protocol.NeighRoute { |
| 235 | routes := make([]*protocol.NeighRoute, 0, len(neigh.Routes)) |
no test coverage detected