diff --git a/pkg/innerring/processors/netmap/nodevalidation/maddress/calls.go b/pkg/innerring/processors/netmap/nodevalidation/maddress/calls.go new file mode 100644 index 000000000..2b99f3b64 --- /dev/null +++ b/pkg/innerring/processors/netmap/nodevalidation/maddress/calls.go @@ -0,0 +1,18 @@ +package maddress + +import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/nspcc-dev/neofs-node/pkg/network" +) + +// VerifyAndUpdate calls network.VerifyAddress. +func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error { + err := network.VerifyMultiAddress(n) + if err != nil { + return fmt.Errorf("could not verify multiaddress: %w", err) + } + + return nil +} diff --git a/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go new file mode 100644 index 000000000..91bb8da26 --- /dev/null +++ b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go @@ -0,0 +1,17 @@ +package maddress + +// Validator is an utility that verifies node +// multiaddress. +// +// For correct operation, Validator must be created +// using the constructor (New). After successful creation, +// the Validator is immediately ready to work through API. +type Validator struct {} + +// New creates a new instance of the Validator. +// +// The created Validator does not require additional +// initialization and is completely ready for work. +func New() *Validator { + return &Validator{} +}