forked from TrueCloudLab/frostfs-sdk-go
b8989e3abb
Create `subnet` package. Define `ID` type of subnet identifiers. Implement encoding and support NeoFS API V2 protocol. Provide method to init instance from integer. Implement function which checks if `ID` instance refers to zero subnet. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
16 lines
281 B
Go
16 lines
281 B
Go
package subnetidtest
|
|
|
|
import (
|
|
"math/rand"
|
|
|
|
subnetid "github.com/nspcc-dev/neofs-sdk-go/subnet/id"
|
|
)
|
|
|
|
// GenerateID generates and returns random subnetid.ID using math/rand.Uint32.
|
|
func GenerateID() *subnetid.ID {
|
|
var id subnetid.ID
|
|
|
|
id.SetNumber(rand.Uint32())
|
|
|
|
return &id
|
|
}
|