36-add-route-path-into-route-object

Added the route path into the route object so that we can
see what meshes packets are routed across.
This commit is contained in:
Tim Beatham
2023-11-27 18:55:41 +00:00
parent 3fca49a1c9
commit d8e156f13f
12 changed files with 88 additions and 133 deletions

View File

@ -3,6 +3,7 @@ package query
import (
"encoding/json"
"fmt"
"strings"
"github.com/jmespath/go-jmespath"
"github.com/tim-beatham/wgmesh/pkg/conf"
@ -27,6 +28,7 @@ type QueryError struct {
type QueryRoute struct {
Destination string `json:"destination"`
HopCount int `json:"hopCount"`
Path string `json:"path"`
}
type QueryNode struct {
@ -87,6 +89,7 @@ func MeshNodeToQueryNode(node mesh.MeshNode) *QueryNode {
return QueryRoute{
Destination: r.GetDestination().String(),
HopCount: r.GetHopCount(),
Path: strings.Join(r.GetPath(), ","),
}
})
queryNode.Description = node.GetDescription()