forked from TrueCloudLab/frostfs-node
[#1817] network: Allow to use network addresses from the iterator
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
76893bdc50
commit
236414df49
21 changed files with 203 additions and 17 deletions
|
@ -126,6 +126,8 @@ func flatNodes(ns [][]netmap.NodeInfo) [][]netmap.NodeInfo {
|
|||
type Node struct {
|
||||
addresses network.AddressGroup
|
||||
|
||||
externalAddresses network.AddressGroup
|
||||
|
||||
key []byte
|
||||
}
|
||||
|
||||
|
@ -134,6 +136,11 @@ func (x Node) Addresses() network.AddressGroup {
|
|||
return x.addresses
|
||||
}
|
||||
|
||||
// ExternalAddresses returns group of network addresses.
|
||||
func (x Node) ExternalAddresses() network.AddressGroup {
|
||||
return x.externalAddresses
|
||||
}
|
||||
|
||||
// PublicKey returns public key in a binary format. Should not be mutated.
|
||||
func (x Node) PublicKey() []byte {
|
||||
return x.key
|
||||
|
@ -167,6 +174,12 @@ func (t *Traverser) Next() []Node {
|
|||
return nil
|
||||
}
|
||||
|
||||
ext := t.vectors[0][i].ExternalAddresses()
|
||||
if len(ext) > 0 {
|
||||
// Ignore the error if this field is incorrectly formed.
|
||||
_ = nodes[i].externalAddresses.FromStringSlice(ext)
|
||||
}
|
||||
|
||||
nodes[i].key = t.vectors[0][i].PublicKey()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue