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

uuid_v2

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

Index

Constants

const (
    // UUIDv2Epoch is the epoch of the UUIDv2 timestamp
    // It is the number of 100-nanosecond intervals since October 15, 1582
    UUIDv2Epoch = uint64(122192928000000000)
)

type UUIDv2

UUIDv2 represents a UUID v1 structure

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

type UUIDv2 struct {
    uuid.UUID

    LocalDomainNumber uint32

    Time uint64

    Clock uint8

    LocalDomain uint8

    NodeID [6]byte
}

func (*UUIDv2) FromString

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

FromString parses a UUID string in the format “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” and returns a UUIDv2 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 (*UUIDv2) GetClock

func (u *UUIDv2) GetClock() uint8

GetClockuence returns the clock sequence of the UUIDv2 structure

Returns:

  • The clock sequence of the UUIDv2 structure

func (*UUIDv2) GetLocalDomain

func (u *UUIDv2) GetLocalDomain() uint8

GetLocalDomain returns the local domain of the UUIDv2 structure

Returns:

  • The local domain of the UUIDv2 structure

func (*UUIDv2) GetLocalDomainNumber

func (u *UUIDv2) GetLocalDomainNumber() uint32

GetLocalDomainNumber returns the local domain number of the UUIDv2 structure

Returns:

  • The local domain number of the UUIDv2 structure

func (*UUIDv2) GetNodeID

func (u *UUIDv2) GetNodeID() []byte

GetNodeID returns the node ID of the UUIDv2 structure

Returns:

  • The node ID of the UUIDv2 structure

func (*UUIDv2) GetTime

func (u *UUIDv2) GetTime() time.Time

GetTime returns the time of the UUIDv2 structure

Returns:

  • The time of the UUIDv2 structure

func (*UUIDv2) Marshal

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

Marshal converts the UUIDv2 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 (*UUIDv2) SetClock

func (u *UUIDv2) SetClock(clock uint8)

SetClockuence sets the clock sequence field of the UUIDv2 structure

Parameters:

  • clockSeq: The clock sequence to set

func (*UUIDv2) SetLocalDomain

func (u *UUIDv2) SetLocalDomain(localDomain uint8)

SetLocalDomain sets the local domain field of the UUIDv2 structure

Parameters:

  • localDomain: The local domain to set

func (*UUIDv2) SetLocalDomainNumber

func (u *UUIDv2) SetLocalDomainNumber(localDomainNumber uint32)

SetLocalDomainNumber sets the local domain number field of the UUIDv2 structure

Parameters:

  • localDomainNumber: The local domain number to set

func (*UUIDv2) SetNodeID

func (u *UUIDv2) SetNodeID(nodeID []byte) error

SetNodeID sets the node ID field of the UUIDv2 structure

Parameters:

  • nodeID: A byte slice containing the node ID (6 bytes)

Returns:

  • An error if the node ID is invalid

func (*UUIDv2) SetTime

func (u *UUIDv2) SetTime(t time.Time)

SetTime sets the time field of the UUIDv2 structure

Parameters:

  • t: The time to set

func (*UUIDv2) String

func (u *UUIDv2) String() string

String returns the string representation of the UUIDv2 structure

Returns:

  • The string representation of the UUIDv2 structure

func (*UUIDv2) Unmarshal

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

Unmarshal converts a 16-byte array into a UUIDv2 structure

Returns:

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