Skip to content

Commit

Permalink
docs: upd links to rfc9562 (#162)
Browse files Browse the repository at this point in the history
* upd links to draft

* RFC 4122 -> 9562

* add extra comment

---------

Co-authored-by: bormanp <[email protected]>
  • Loading branch information
2 people authored and tkarrass committed Sep 11, 2024
1 parent 27f465a commit a0a48dd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# uuid
The uuid package generates and inspects UUIDs based on
[RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122)
[RFC 9562](https://datatracker.ietf.org/doc/html/rfc9562)
and DCE 1.1: Authentication and Security Services.

This package is based on the github.com/pborman/uuid package (previously named
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Package uuid generates and inspects UUIDs.
//
// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security
// UUIDs are based on RFC 9562(obsoletes RFC 4122) and DCE 1.1: Authentication and Security
// Services.
//
// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to
Expand Down
2 changes: 1 addition & 1 deletion hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID {
var uuid UUID
copy(uuid[:], s)
uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4)
uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant
uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 9562 variant
return uuid
}

Expand Down
11 changes: 8 additions & 3 deletions uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
// 4122.
// 9562.
type UUID [16]byte

// A Version represents a UUID's version.
Expand All @@ -28,12 +28,17 @@ type Variant byte
// Constants returned by Variant.
const (
Invalid = Variant(iota) // Invalid UUID
RFC4122 // The variant specified in RFC4122
RFC4122 // The variant specified in RFC9562(obsoletes RFC4122).
Reserved // Reserved, NCS backward compatibility.
Microsoft // Reserved, Microsoft Corporation backward compatibility.
Future // Reserved for future definition.
)

// RFC9562 added V6 and V7 of UUID, but did not change specification of V1 and V4
// implemented in this module. To avoid creating new major module version,
// we still use RFC4122 for constant name.
const Standard = RFC4122

const randPoolSize = 16 * 16

var (
Expand All @@ -57,7 +62,7 @@ func IsInvalidLengthError(err error) bool {
}

// Parse decodes s into a UUID or returns an error if it cannot be parsed. Both
// the standard UUID forms defined in RFC 4122
// the standard UUID forms defined in RFC 9562
// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition,
// Parse accepts non-standard strings such as the raw hex encoding
Expand Down
2 changes: 1 addition & 1 deletion version6.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "encoding/binary"
// It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs.
// Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead.
//
// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#uuidv6
// see https://datatracker.ietf.org/doc/html/rfc9562#uuidv6
//
// NewV6 returns a Version 6 UUID based on the current NodeID and clock
// sequence, and the current time. If the NodeID has not been set by SetNodeID
Expand Down
2 changes: 1 addition & 1 deletion version7.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
// As well as improved entropy characteristics over versions 1 or 6.
//
// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#name-uuid-version-7
// see https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-7
//
// Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible.
//
Expand Down

0 comments on commit a0a48dd

Please sign in to comment.