packages/hyprspace: print node names in route show

This commit is contained in:
Max Headroom 2024-04-22 14:48:32 +02:00
parent a4d5782a7f
commit aadc5f3e7b
3 changed files with 5 additions and 0 deletions

View file

@ -42,6 +42,9 @@ func RouteRun(r *cmd.Root, c *cmd.Sub) {
} else { } else {
target = fmt.Sprintf("/p2p/%s", r.TargetAddr) target = fmt.Sprintf("/p2p/%s", r.TargetAddr)
} }
if r.TargetName != "" {
target = fmt.Sprintf("@%s %s", r.TargetName, target)
}
if r.IsConnected { if r.IsConnected {
connectStatus = " connected" connectStatus = " connected"
} }

View file

@ -93,6 +93,7 @@ func (hsr *HyprspaceRPC) Route(args *RouteArgs, reply *RouteReply) error {
} }
routeInfos = append(routeInfos, RouteInfo{ routeInfos = append(routeInfos, RouteInfo{
Network: rte.Network(), Network: rte.Network(),
TargetName: rte.Target.Name,
TargetAddr: rte.Target.ID, TargetAddr: rte.Target.ID,
RelayAddr: relayAddr, RelayAddr: relayAddr,
IsRelay: relay, IsRelay: relay,

View file

@ -32,6 +32,7 @@ const (
type RouteInfo struct { type RouteInfo struct {
Network net.IPNet Network net.IPNet
TargetName string
TargetAddr peer.ID TargetAddr peer.ID
RelayAddr peer.ID RelayAddr peer.ID
IsRelay bool IsRelay bool