forked from TrueCloudLab/frostfs-node
[#607] network: Implement function to stringify AddressGroup
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
c82615667d
commit
5db7c5c2a8
1 changed files with 15 additions and 0 deletions
|
@ -11,6 +11,21 @@ import (
|
||||||
// List is sorted by priority of use.
|
// List is sorted by priority of use.
|
||||||
type AddressGroup []Address
|
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.
|
// IterateAddresses iterates over all network addresses of the node.
|
||||||
//
|
//
|
||||||
// Breaks iterating on handler's true return.
|
// Breaks iterating on handler's true return.
|
||||||
|
|
Loading…
Reference in a new issue