From 59d163885aba53b641f19565317f19d88dcd56dd Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 1 Jul 2021 13:36:38 +0300 Subject: [PATCH] Mode NodeName to appropriate place --- src/humanizer.go | 9 --------- src/node.go | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/humanizer.go b/src/humanizer.go index 69d1bb5..701b590 100644 --- a/src/humanizer.go +++ b/src/humanizer.go @@ -25,15 +25,6 @@ import ( "go.cypherpunks.ru/recfile" ) -func (ctx *Ctx) NodeName(id *NodeId) string { - idS := id.String() - node, err := ctx.FindNode(idS) - if err == nil { - return node.Name - } - return idS -} - func (ctx *Ctx) HumanizeRec(rec string) string { r := recfile.NewReader(strings.NewReader(rec)) le, err := r.NextMap() diff --git a/src/node.go b/src/node.go index 4a28bca..f5bea18 100644 --- a/src/node.go +++ b/src/node.go @@ -123,3 +123,12 @@ func NodeIdFromString(raw string) (*NodeId, error) { copy(nodeId[:], decoded) return nodeId, nil } + +func (ctx *Ctx) NodeName(id *NodeId) string { + idS := id.String() + node, err := ctx.FindNode(idS) + if err == nil { + return node.Name + } + return idS +} -- 2.44.0