| 213 | } |
| 214 | |
| 215 | func (h *Harness) ReadStatus(nodeName string) (*protocol.StatusResponse, error) { |
| 216 | stdout, _, err := h.Exec(nodeName, []string{"nylon", "status", "-i", "nylon0", "--json"}) |
| 217 | if err != nil { |
| 218 | return nil, err |
| 219 | } |
| 220 | resp := &protocol.IpcResponse{} |
| 221 | if err := protojson.Unmarshal([]byte(stdout), resp); err != nil { |
| 222 | return nil, err |
| 223 | } |
| 224 | return resp.GetStatus(), nil |
| 225 | } |
| 226 | |
| 227 | func HasSelectedRoute(status *protocol.StatusResponse, prefix, nh, router string) bool { |
| 228 | for _, route := range status.GetRoutes().GetSelected() { |