[#645] core/client: Add public key to NodeInfo structure

There is a need to process announced public keys of storage nodes for
intra-container communication.

Implement `PublicKey` / `SetPublicKey` methods of `client.NodeInfo` type.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-28 07:49:28 +03:00 committed by Alex Vanin
parent 7b228b7603
commit 4ec7e24b85

View file

@ -19,6 +19,8 @@ type Client interface {
// NodeInfo groups information about NeoFS storage node needed for Client construction. // NodeInfo groups information about NeoFS storage node needed for Client construction.
type NodeInfo struct { type NodeInfo struct {
addrGroup network.AddressGroup addrGroup network.AddressGroup
key []byte
} }
// SetAddressGroup sets group of network addresses. // SetAddressGroup sets group of network addresses.
@ -30,3 +32,17 @@ func (x *NodeInfo) SetAddressGroup(v network.AddressGroup) {
func (x NodeInfo) AddressGroup() network.AddressGroup { func (x NodeInfo) AddressGroup() network.AddressGroup {
return x.addrGroup return x.addrGroup
} }
// SetPublicKey sets public key in a binary format.
//
// Argument must not be mutated.
func (x *NodeInfo) SetPublicKey(v []byte) {
x.key = v
}
// PublicKey returns public key in a binary format.
//
// Result must not be mutated.
func (x *NodeInfo) PublicKey() []byte {
return x.key
}