Skip to content

Commit d55c313

Browse files
docs: upd links to rfc9562 (#162)
* upd links to draft * RFC 4122 -> 9562 * add extra comment --------- Co-authored-by: bormanp <[email protected]>
1 parent e8d82d3 commit d55c313

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# uuid
22
The uuid package generates and inspects UUIDs based on
3-
[RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122)
3+
[RFC 9562](https://datatracker.ietf.org/doc/html/rfc9562)
44
and DCE 1.1: Authentication and Security Services.
55

66
This package is based on the github.com/pborman/uuid package (previously named

doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Package uuid generates and inspects UUIDs.
66
//
7-
// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security
7+
// UUIDs are based on RFC 9562(obsoletes RFC 4122) and DCE 1.1: Authentication and Security
88
// Services.
99
//
1010
// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to

hash.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID {
3838
var uuid UUID
3939
copy(uuid[:], s)
4040
uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4)
41-
uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant
41+
uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 9562 variant
4242
return uuid
4343
}
4444

uuid.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

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

2222
// A Version represents a UUID's version.
@@ -28,12 +28,17 @@ type Variant byte
2828
// Constants returned by Variant.
2929
const (
3030
Invalid = Variant(iota) // Invalid UUID
31-
RFC4122 // The variant specified in RFC4122
31+
RFC4122 // The variant specified in RFC9562(obsoletes RFC4122).
3232
Reserved // Reserved, NCS backward compatibility.
3333
Microsoft // Reserved, Microsoft Corporation backward compatibility.
3434
Future // Reserved for future definition.
3535
)
3636

37+
// RFC9562 added V6 and V7 of UUID, but did not change specification of V1 and V4
38+
// implemented in this module. To avoid creating new major module version,
39+
// we still use RFC4122 for constant name.
40+
const Standard = RFC4122
41+
3742
const randPoolSize = 16 * 16
3843

3944
var (
@@ -57,7 +62,7 @@ func IsInvalidLengthError(err error) bool {
5762
}
5863

5964
// Parse decodes s into a UUID or returns an error if it cannot be parsed. Both
60-
// the standard UUID forms defined in RFC 4122
65+
// the standard UUID forms defined in RFC 9562
6166
// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
6267
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition,
6368
// Parse accepts non-standard strings such as the raw hex encoding

version6.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import "encoding/binary"
1010
// It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs.
1111
// Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead.
1212
//
13-
// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#uuidv6
13+
// see https://datatracker.ietf.org/doc/html/rfc9562#uuidv6
1414
//
1515
// NewV6 returns a Version 6 UUID based on the current NodeID and clock
1616
// sequence, and the current time. If the NodeID has not been set by SetNodeID

version7.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
1414
// As well as improved entropy characteristics over versions 1 or 6.
1515
//
16-
// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#name-uuid-version-7
16+
// see https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-7
1717
//
1818
// Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible.
1919
//

0 commit comments

Comments
 (0)