From 5db7c5c2a8974967a822a65e9055feb219209df7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Jun 2021 19:50:00 +0300 Subject: [PATCH] [#607] network: Implement function to stringify AddressGroup Signed-off-by: Leonard Lyubich --- pkg/network/group.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/network/group.go b/pkg/network/group.go index 24d6a0b3..d5fedae4 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -11,6 +11,21 @@ import ( // List is sorted by priority of use. type AddressGroup []Address +// StringifyGroup returns concatenation of all addresses +// from the AddressGroup. +// +// The result is order-dependent. +func StringifyGroup(x AddressGroup) string { + var s string + + x.IterateAddresses(func(addr Address) bool { + s += addr.String() + return false + }) + + return s +} + // IterateAddresses iterates over all network addresses of the node. // // Breaks iterating on handler's true return.