Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

uuid_v8

import "github.com/TheManticoreProject/Manticore/crypto/uuid/uuid_v8"

Index

Constants

UUIDv8 namespaces Source: https://www.rfc-editor.org/rfc/rfc4122#appendix-C

const (
    UUIDv8NamespaceDNS  = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
    UUIDv8NamespaceURL  = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
    UUIDv8NamespaceOID  = "6ba7b812-9dad-11d1-80b4-00c04fd430c8"
    UUIDv8NamespaceX500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8"
)

type UUIDv8

UUIDv8 represents a UUID v1 structure

UUIDv8 is a structure that represents a UUID v1. It contains a UUID, a time, a clock sequence, and a node ID.

type UUIDv8 struct {
    uuid.UUID

    Data [15]byte
}

func (*UUIDv8) FromString

func (u *UUIDv8) FromString(uuidStr string) error

FromString parses a UUID string in the format “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” and returns a UUIDv8 structure.

Parameters:

  • uuidStr: A string containing the UUID in the format “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”

Returns:

  • An error if the UUID is invalid or the conversion fails

func (*UUIDv8) GetData

func (u *UUIDv8) GetData() []byte

GetData returns the data of the UUIDv8 structure

Returns:

  • A byte slice containing the UUID’s 15 bytes

func (*UUIDv8) Marshal

func (u *UUIDv8) Marshal() ([]byte, error)

Marshal converts the UUIDv8 structure to a 16-byte array

Returns:

  • A byte slice containing the UUID’s 16 bytes
  • An error if the UUID is invalid or the conversion fails

func (*UUIDv8) SetData

func (u *UUIDv8) SetData(data []byte)

SetData sets the data of the UUIDv8 structure

Parameters:

  • data: A byte slice containing the UUID’s 15 bytes

func (*UUIDv8) String

func (u *UUIDv8) String() string

String returns the string representation of the UUIDv8 structure

Returns:

  • The string representation of the UUIDv8 structure

func (*UUIDv8) Unmarshal

func (u *UUIDv8) Unmarshal(marshalledData []byte) (int, error)

Unmarshal converts a 16-byte array into a UUIDv8 structure

Returns:

  • The number of bytes read
  • An error if the UUID is invalid or the conversion fails