aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/google
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google')
-rw-r--r--vendor/github.com/google/uuid/CHANGELOG.md28
-rw-r--r--vendor/github.com/google/uuid/CONTRIBUTING.md26
-rw-r--r--vendor/github.com/google/uuid/CONTRIBUTORS9
-rw-r--r--vendor/github.com/google/uuid/LICENSE27
-rw-r--r--vendor/github.com/google/uuid/README.md21
-rw-r--r--vendor/github.com/google/uuid/dce.go80
-rw-r--r--vendor/github.com/google/uuid/doc.go12
-rw-r--r--vendor/github.com/google/uuid/hash.go53
-rw-r--r--vendor/github.com/google/uuid/marshal.go38
-rw-r--r--vendor/github.com/google/uuid/node.go90
-rw-r--r--vendor/github.com/google/uuid/node_js.go12
-rw-r--r--vendor/github.com/google/uuid/node_net.go33
-rw-r--r--vendor/github.com/google/uuid/null.go118
-rw-r--r--vendor/github.com/google/uuid/sql.go59
-rw-r--r--vendor/github.com/google/uuid/time.go134
-rw-r--r--vendor/github.com/google/uuid/util.go43
-rw-r--r--vendor/github.com/google/uuid/uuid.go365
-rw-r--r--vendor/github.com/google/uuid/version1.go44
-rw-r--r--vendor/github.com/google/uuid/version4.go76
-rw-r--r--vendor/github.com/google/uuid/version6.go56
-rw-r--r--vendor/github.com/google/uuid/version7.go75
21 files changed, 0 insertions, 1399 deletions
diff --git a/vendor/github.com/google/uuid/CHANGELOG.md b/vendor/github.com/google/uuid/CHANGELOG.md
deleted file mode 100644
index c9fb829..0000000
--- a/vendor/github.com/google/uuid/CHANGELOG.md
+++ /dev/null
@@ -1,28 +0,0 @@
1# Changelog
2
3## [1.5.0](https://github.com/google/uuid/compare/v1.4.0...v1.5.0) (2023-12-12)
4
5
6### Features
7
8* Validate UUID without creating new UUID ([#141](https://github.com/google/uuid/issues/141)) ([9ee7366](https://github.com/google/uuid/commit/9ee7366e66c9ad96bab89139418a713dc584ae29))
9
10## [1.4.0](https://github.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26)
11
12
13### Features
14
15* UUIDs slice type with Strings() convenience method ([#133](https://github.com/google/uuid/issues/133)) ([cd5fbbd](https://github.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4))
16
17### Fixes
18
19* Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior)
20
21## [1.3.1](https://github.com/google/uuid/compare/v1.3.0...v1.3.1) (2023-08-18)
22
23
24### Bug Fixes
25
26* Use .EqualFold() to parse urn prefixed UUIDs ([#118](https://github.com/google/uuid/issues/118)) ([574e687](https://github.com/google/uuid/commit/574e6874943741fb99d41764c705173ada5293f0))
27
28## Changelog
diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md
deleted file mode 100644
index a502fdc..0000000
--- a/vendor/github.com/google/uuid/CONTRIBUTING.md
+++ /dev/null
@@ -1,26 +0,0 @@
1# How to contribute
2
3We definitely welcome patches and contribution to this project!
4
5### Tips
6
7Commits must be formatted according to the [Conventional Commits Specification](https://www.conventionalcommits.org).
8
9Always try to include a test case! If it is not possible or not necessary,
10please explain why in the pull request description.
11
12### Releasing
13
14Commits that would precipitate a SemVer change, as described in the Conventional
15Commits Specification, will trigger [`release-please`](https://github.com/google-github-actions/release-please-action)
16to create a release candidate pull request. Once submitted, `release-please`
17will create a release.
18
19For tips on how to work with `release-please`, see its documentation.
20
21### Legal requirements
22
23In order to protect both you and ourselves, you will need to sign the
24[Contributor License Agreement](https://cla.developers.google.com/clas).
25
26You may have already signed it for other Google projects.
diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS
deleted file mode 100644
index b4bb97f..0000000
--- a/vendor/github.com/google/uuid/CONTRIBUTORS
+++ /dev/null
@@ -1,9 +0,0 @@
1Paul Borman <[email protected]>
2bmatsuo
3shawnps
4theory
5jboverfelt
6dsymonds
7cd1
8wallclockbuilder
9dansouza
diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE
deleted file mode 100644
index 5dc6826..0000000
--- a/vendor/github.com/google/uuid/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
1Copyright (c) 2009,2014 Google Inc. All rights reserved.
2
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are
5met:
6
7 * Redistributions of source code must retain the above copyright
8notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above
10copyright notice, this list of conditions and the following disclaimer
11in the documentation and/or other materials provided with the
12distribution.
13 * Neither the name of Google Inc. nor the names of its
14contributors may be used to endorse or promote products derived from
15this software without specific prior written permission.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md
deleted file mode 100644
index 3e9a618..0000000
--- a/vendor/github.com/google/uuid/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
1# uuid
2The uuid package generates and inspects UUIDs based on
3[RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122)
4and DCE 1.1: Authentication and Security Services.
5
6This package is based on the github.com/pborman/uuid package (previously named
7code.google.com/p/go-uuid). It differs from these earlier packages in that
8a UUID is a 16 byte array rather than a byte slice. One loss due to this
9change is the ability to represent an invalid UUID (vs a NIL UUID).
10
11###### Install
12```sh
13go get github.com/google/uuid
14```
15
16###### Documentation
17[![Go Reference](https://pkg.go.dev/badge/github.com/google/uuid.svg)](https://pkg.go.dev/github.com/google/uuid)
18
19Full `go doc` style documentation for the package can be viewed online without
20installing this package by using the GoDoc site here:
21http://pkg.go.dev/github.com/google/uuid
diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go
deleted file mode 100644
index fa820b9..0000000
--- a/vendor/github.com/google/uuid/dce.go
+++ /dev/null
@@ -1,80 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "encoding/binary"
9 "fmt"
10 "os"
11)
12
13// A Domain represents a Version 2 domain
14type Domain byte
15
16// Domain constants for DCE Security (Version 2) UUIDs.
17const (
18 Person = Domain(0)
19 Group = Domain(1)
20 Org = Domain(2)
21)
22
23// NewDCESecurity returns a DCE Security (Version 2) UUID.
24//
25// The domain should be one of Person, Group or Org.
26// On a POSIX system the id should be the users UID for the Person
27// domain and the users GID for the Group. The meaning of id for
28// the domain Org or on non-POSIX systems is site defined.
29//
30// For a given domain/id pair the same token may be returned for up to
31// 7 minutes and 10 seconds.
32func NewDCESecurity(domain Domain, id uint32) (UUID, error) {
33 uuid, err := NewUUID()
34 if err == nil {
35 uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2
36 uuid[9] = byte(domain)
37 binary.BigEndian.PutUint32(uuid[0:], id)
38 }
39 return uuid, err
40}
41
42// NewDCEPerson returns a DCE Security (Version 2) UUID in the person
43// domain with the id returned by os.Getuid.
44//
45// NewDCESecurity(Person, uint32(os.Getuid()))
46func NewDCEPerson() (UUID, error) {
47 return NewDCESecurity(Person, uint32(os.Getuid()))
48}
49
50// NewDCEGroup returns a DCE Security (Version 2) UUID in the group
51// domain with the id returned by os.Getgid.
52//
53// NewDCESecurity(Group, uint32(os.Getgid()))
54func NewDCEGroup() (UUID, error) {
55 return NewDCESecurity(Group, uint32(os.Getgid()))
56}
57
58// Domain returns the domain for a Version 2 UUID. Domains are only defined
59// for Version 2 UUIDs.
60func (uuid UUID) Domain() Domain {
61 return Domain(uuid[9])
62}
63
64// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2
65// UUIDs.
66func (uuid UUID) ID() uint32 {
67 return binary.BigEndian.Uint32(uuid[0:4])
68}
69
70func (d Domain) String() string {
71 switch d {
72 case Person:
73 return "Person"
74 case Group:
75 return "Group"
76 case Org:
77 return "Org"
78 }
79 return fmt.Sprintf("Domain%d", int(d))
80}
diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go
deleted file mode 100644
index 5b8a4b9..0000000
--- a/vendor/github.com/google/uuid/doc.go
+++ /dev/null
@@ -1,12 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package uuid generates and inspects UUIDs.
6//
7// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security
8// Services.
9//
10// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to
11// maps or compared directly.
12package uuid
diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go
deleted file mode 100644
index b404f4b..0000000
--- a/vendor/github.com/google/uuid/hash.go
+++ /dev/null
@@ -1,53 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "crypto/md5"
9 "crypto/sha1"
10 "hash"
11)
12
13// Well known namespace IDs and UUIDs
14var (
15 NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8"))
16 NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8"))
17 NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8"))
18 NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8"))
19 Nil UUID // empty UUID, all zeros
20)
21
22// NewHash returns a new UUID derived from the hash of space concatenated with
23// data generated by h. The hash should be at least 16 byte in length. The
24// first 16 bytes of the hash are used to form the UUID. The version of the
25// UUID will be the lower 4 bits of version. NewHash is used to implement
26// NewMD5 and NewSHA1.
27func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID {
28 h.Reset()
29 h.Write(space[:]) //nolint:errcheck
30 h.Write(data) //nolint:errcheck
31 s := h.Sum(nil)
32 var uuid UUID
33 copy(uuid[:], s)
34 uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4)
35 uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant
36 return uuid
37}
38
39// NewMD5 returns a new MD5 (Version 3) UUID based on the
40// supplied name space and data. It is the same as calling:
41//
42// NewHash(md5.New(), space, data, 3)
43func NewMD5(space UUID, data []byte) UUID {
44 return NewHash(md5.New(), space, data, 3)
45}
46
47// NewSHA1 returns a new SHA1 (Version 5) UUID based on the
48// supplied name space and data. It is the same as calling:
49//
50// NewHash(sha1.New(), space, data, 5)
51func NewSHA1(space UUID, data []byte) UUID {
52 return NewHash(sha1.New(), space, data, 5)
53}
diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go
deleted file mode 100644
index 14bd340..0000000
--- a/vendor/github.com/google/uuid/marshal.go
+++ /dev/null
@@ -1,38 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import "fmt"
8
9// MarshalText implements encoding.TextMarshaler.
10func (uuid UUID) MarshalText() ([]byte, error) {
11 var js [36]byte
12 encodeHex(js[:], uuid)
13 return js[:], nil
14}
15
16// UnmarshalText implements encoding.TextUnmarshaler.
17func (uuid *UUID) UnmarshalText(data []byte) error {
18 id, err := ParseBytes(data)
19 if err != nil {
20 return err
21 }
22 *uuid = id
23 return nil
24}
25
26// MarshalBinary implements encoding.BinaryMarshaler.
27func (uuid UUID) MarshalBinary() ([]byte, error) {
28 return uuid[:], nil
29}
30
31// UnmarshalBinary implements encoding.BinaryUnmarshaler.
32func (uuid *UUID) UnmarshalBinary(data []byte) error {
33 if len(data) != 16 {
34 return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
35 }
36 copy(uuid[:], data)
37 return nil
38}
diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go
deleted file mode 100644
index d651a2b..0000000
--- a/vendor/github.com/google/uuid/node.go
+++ /dev/null
@@ -1,90 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "sync"
9)
10
11var (
12 nodeMu sync.Mutex
13 ifname string // name of interface being used
14 nodeID [6]byte // hardware for version 1 UUIDs
15 zeroID [6]byte // nodeID with only 0's
16)
17
18// NodeInterface returns the name of the interface from which the NodeID was
19// derived. The interface "user" is returned if the NodeID was set by
20// SetNodeID.
21func NodeInterface() string {
22 defer nodeMu.Unlock()
23 nodeMu.Lock()
24 return ifname
25}
26
27// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs.
28// If name is "" then the first usable interface found will be used or a random
29// Node ID will be generated. If a named interface cannot be found then false
30// is returned.
31//
32// SetNodeInterface never fails when name is "".
33func SetNodeInterface(name string) bool {
34 defer nodeMu.Unlock()
35 nodeMu.Lock()
36 return setNodeInterface(name)
37}
38
39func setNodeInterface(name string) bool {
40 iname, addr := getHardwareInterface(name) // null implementation for js
41 if iname != "" && addr != nil {
42 ifname = iname
43 copy(nodeID[:], addr)
44 return true
45 }
46
47 // We found no interfaces with a valid hardware address. If name
48 // does not specify a specific interface generate a random Node ID
49 // (section 4.1.6)
50 if name == "" {
51 ifname = "random"
52 randomBits(nodeID[:])
53 return true
54 }
55 return false
56}
57
58// NodeID returns a slice of a copy of the current Node ID, setting the Node ID
59// if not already set.
60func NodeID() []byte {
61 defer nodeMu.Unlock()
62 nodeMu.Lock()
63 if nodeID == zeroID {
64 setNodeInterface("")
65 }
66 nid := nodeID
67 return nid[:]
68}
69
70// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes
71// of id are used. If id is less than 6 bytes then false is returned and the
72// Node ID is not set.
73func SetNodeID(id []byte) bool {
74 if len(id) < 6 {
75 return false
76 }
77 defer nodeMu.Unlock()
78 nodeMu.Lock()
79 copy(nodeID[:], id)
80 ifname = "user"
81 return true
82}
83
84// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is
85// not valid. The NodeID is only well defined for version 1 and 2 UUIDs.
86func (uuid UUID) NodeID() []byte {
87 var node [6]byte
88 copy(node[:], uuid[10:])
89 return node[:]
90}
diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go
deleted file mode 100644
index b2a0bc8..0000000
--- a/vendor/github.com/google/uuid/node_js.go
+++ /dev/null
@@ -1,12 +0,0 @@
1// Copyright 2017 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build js
6
7package uuid
8
9// getHardwareInterface returns nil values for the JS version of the code.
10// This removes the "net" dependency, because it is not used in the browser.
11// Using the "net" library inflates the size of the transpiled JS code by 673k bytes.
12func getHardwareInterface(name string) (string, []byte) { return "", nil }
diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go
deleted file mode 100644
index 0cbbcdd..0000000
--- a/vendor/github.com/google/uuid/node_net.go
+++ /dev/null
@@ -1,33 +0,0 @@
1// Copyright 2017 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build !js
6
7package uuid
8
9import "net"
10
11var interfaces []net.Interface // cached list of interfaces
12
13// getHardwareInterface returns the name and hardware address of interface name.
14// If name is "" then the name and hardware address of one of the system's
15// interfaces is returned. If no interfaces are found (name does not exist or
16// there are no interfaces) then "", nil is returned.
17//
18// Only addresses of at least 6 bytes are returned.
19func getHardwareInterface(name string) (string, []byte) {
20 if interfaces == nil {
21 var err error
22 interfaces, err = net.Interfaces()
23 if err != nil {
24 return "", nil
25 }
26 }
27 for _, ifs := range interfaces {
28 if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
29 return ifs.Name, ifs.HardwareAddr
30 }
31 }
32 return "", nil
33}
diff --git a/vendor/github.com/google/uuid/null.go b/vendor/github.com/google/uuid/null.go
deleted file mode 100644
index d7fcbf2..0000000
--- a/vendor/github.com/google/uuid/null.go
+++ /dev/null
@@ -1,118 +0,0 @@
1// Copyright 2021 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "bytes"
9 "database/sql/driver"
10 "encoding/json"
11 "fmt"
12)
13
14var jsonNull = []byte("null")
15
16// NullUUID represents a UUID that may be null.
17// NullUUID implements the SQL driver.Scanner interface so
18// it can be used as a scan destination:
19//
20// var u uuid.NullUUID
21// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u)
22// ...
23// if u.Valid {
24// // use u.UUID
25// } else {
26// // NULL value
27// }
28//
29type NullUUID struct {
30 UUID UUID
31 Valid bool // Valid is true if UUID is not NULL
32}
33
34// Scan implements the SQL driver.Scanner interface.
35func (nu *NullUUID) Scan(value interface{}) error {
36 if value == nil {
37 nu.UUID, nu.Valid = Nil, false
38 return nil
39 }
40
41 err := nu.UUID.Scan(value)
42 if err != nil {
43 nu.Valid = false
44 return err
45 }
46
47 nu.Valid = true
48 return nil
49}
50
51// Value implements the driver Valuer interface.
52func (nu NullUUID) Value() (driver.Value, error) {
53 if !nu.Valid {
54 return nil, nil
55 }
56 // Delegate to UUID Value function
57 return nu.UUID.Value()
58}
59
60// MarshalBinary implements encoding.BinaryMarshaler.
61func (nu NullUUID) MarshalBinary() ([]byte, error) {
62 if nu.Valid {
63 return nu.UUID[:], nil
64 }
65
66 return []byte(nil), nil
67}
68
69// UnmarshalBinary implements encoding.BinaryUnmarshaler.
70func (nu *NullUUID) UnmarshalBinary(data []byte) error {
71 if len(data) != 16 {
72 return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
73 }
74 copy(nu.UUID[:], data)
75 nu.Valid = true
76 return nil
77}
78
79// MarshalText implements encoding.TextMarshaler.
80func (nu NullUUID) MarshalText() ([]byte, error) {
81 if nu.Valid {
82 return nu.UUID.MarshalText()
83 }
84
85 return jsonNull, nil
86}
87
88// UnmarshalText implements encoding.TextUnmarshaler.
89func (nu *NullUUID) UnmarshalText(data []byte) error {
90 id, err := ParseBytes(data)
91 if err != nil {
92 nu.Valid = false
93 return err
94 }
95 nu.UUID = id
96 nu.Valid = true
97 return nil
98}
99
100// MarshalJSON implements json.Marshaler.
101func (nu NullUUID) MarshalJSON() ([]byte, error) {
102 if nu.Valid {
103 return json.Marshal(nu.UUID)
104 }
105
106 return jsonNull, nil
107}
108
109// UnmarshalJSON implements json.Unmarshaler.
110func (nu *NullUUID) UnmarshalJSON(data []byte) error {
111 if bytes.Equal(data, jsonNull) {
112 *nu = NullUUID{}
113 return nil // valid null UUID
114 }
115 err := json.Unmarshal(data, &nu.UUID)
116 nu.Valid = err == nil
117 return err
118}
diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go
deleted file mode 100644
index 2e02ec0..0000000
--- a/vendor/github.com/google/uuid/sql.go
+++ /dev/null
@@ -1,59 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "database/sql/driver"
9 "fmt"
10)
11
12// Scan implements sql.Scanner so UUIDs can be read from databases transparently.
13// Currently, database types that map to string and []byte are supported. Please
14// consult database-specific driver documentation for matching types.
15func (uuid *UUID) Scan(src interface{}) error {
16 switch src := src.(type) {
17 case nil:
18 return nil
19
20 case string:
21 // if an empty UUID comes from a table, we return a null UUID
22 if src == "" {
23 return nil
24 }
25
26 // see Parse for required string format
27 u, err := Parse(src)
28 if err != nil {
29 return fmt.Errorf("Scan: %v", err)
30 }
31
32 *uuid = u
33
34 case []byte:
35 // if an empty UUID comes from a table, we return a null UUID
36 if len(src) == 0 {
37 return nil
38 }
39
40 // assumes a simple slice of bytes if 16 bytes
41 // otherwise attempts to parse
42 if len(src) != 16 {
43 return uuid.Scan(string(src))
44 }
45 copy((*uuid)[:], src)
46
47 default:
48 return fmt.Errorf("Scan: unable to scan type %T into UUID", src)
49 }
50
51 return nil
52}
53
54// Value implements sql.Valuer so that UUIDs can be written to databases
55// transparently. Currently, UUIDs map to strings. Please consult
56// database-specific driver documentation for matching types.
57func (uuid UUID) Value() (driver.Value, error) {
58 return uuid.String(), nil
59}
diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go
deleted file mode 100644
index c351129..0000000
--- a/vendor/github.com/google/uuid/time.go
+++ /dev/null
@@ -1,134 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "encoding/binary"
9 "sync"
10 "time"
11)
12
13// A Time represents a time as the number of 100's of nanoseconds since 15 Oct
14// 1582.
15type Time int64
16
17const (
18 lillian = 2299160 // Julian day of 15 Oct 1582
19 unix = 2440587 // Julian day of 1 Jan 1970
20 epoch = unix - lillian // Days between epochs
21 g1582 = epoch * 86400 // seconds between epochs
22 g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs
23)
24
25var (
26 timeMu sync.Mutex
27 lasttime uint64 // last time we returned
28 clockSeq uint16 // clock sequence for this run
29
30 timeNow = time.Now // for testing
31)
32
33// UnixTime converts t the number of seconds and nanoseconds using the Unix
34// epoch of 1 Jan 1970.
35func (t Time) UnixTime() (sec, nsec int64) {
36 sec = int64(t - g1582ns100)
37 nsec = (sec % 10000000) * 100
38 sec /= 10000000
39 return sec, nsec
40}
41
42// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and
43// clock sequence as well as adjusting the clock sequence as needed. An error
44// is returned if the current time cannot be determined.
45func GetTime() (Time, uint16, error) {
46 defer timeMu.Unlock()
47 timeMu.Lock()
48 return getTime()
49}
50
51func getTime() (Time, uint16, error) {
52 t := timeNow()
53
54 // If we don't have a clock sequence already, set one.
55 if clockSeq == 0 {
56 setClockSequence(-1)
57 }
58 now := uint64(t.UnixNano()/100) + g1582ns100
59
60 // If time has gone backwards with this clock sequence then we
61 // increment the clock sequence
62 if now <= lasttime {
63 clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000
64 }
65 lasttime = now
66 return Time(now), clockSeq, nil
67}
68
69// ClockSequence returns the current clock sequence, generating one if not
70// already set. The clock sequence is only used for Version 1 UUIDs.
71//
72// The uuid package does not use global static storage for the clock sequence or
73// the last time a UUID was generated. Unless SetClockSequence is used, a new
74// random clock sequence is generated the first time a clock sequence is
75// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1)
76func ClockSequence() int {
77 defer timeMu.Unlock()
78 timeMu.Lock()
79 return clockSequence()
80}
81
82func clockSequence() int {
83 if clockSeq == 0 {
84 setClockSequence(-1)
85 }
86 return int(clockSeq & 0x3fff)
87}
88
89// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to
90// -1 causes a new sequence to be generated.
91func SetClockSequence(seq int) {
92 defer timeMu.Unlock()
93 timeMu.Lock()
94 setClockSequence(seq)
95}
96
97func setClockSequence(seq int) {
98 if seq == -1 {
99 var b [2]byte
100 randomBits(b[:]) // clock sequence
101 seq = int(b[0])<<8 | int(b[1])
102 }
103 oldSeq := clockSeq
104 clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant
105 if oldSeq != clockSeq {
106 lasttime = 0
107 }
108}
109
110// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in
111// uuid. The time is only defined for version 1, 2, 6 and 7 UUIDs.
112func (uuid UUID) Time() Time {
113 var t Time
114 switch uuid.Version() {
115 case 6:
116 time := binary.BigEndian.Uint64(uuid[:8]) // Ignore uuid[6] version b0110
117 t = Time(time)
118 case 7:
119 time := binary.BigEndian.Uint64(uuid[:8])
120 t = Time((time>>16)*10000 + g1582ns100)
121 default: // forward compatible
122 time := int64(binary.BigEndian.Uint32(uuid[0:4]))
123 time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
124 time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
125 t = Time(time)
126 }
127 return t
128}
129
130// ClockSequence returns the clock sequence encoded in uuid.
131// The clock sequence is only well defined for version 1 and 2 UUIDs.
132func (uuid UUID) ClockSequence() int {
133 return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff
134}
diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go
deleted file mode 100644
index 5ea6c73..0000000
--- a/vendor/github.com/google/uuid/util.go
+++ /dev/null
@@ -1,43 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "io"
9)
10
11// randomBits completely fills slice b with random data.
12func randomBits(b []byte) {
13 if _, err := io.ReadFull(rander, b); err != nil {
14 panic(err.Error()) // rand should never fail
15 }
16}
17
18// xvalues returns the value of a byte as a hexadecimal digit or 255.
19var xvalues = [256]byte{
20 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
21 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
22 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
23 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255,
24 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
25 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
26 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
27 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
28 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
29 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
30 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
31 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
32 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
33 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
34 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
35 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
36}
37
38// xtob converts hex characters x1 and x2 into a byte.
39func xtob(x1, x2 byte) (byte, bool) {
40 b1 := xvalues[x1]
41 b2 := xvalues[x2]
42 return (b1 << 4) | b2, b1 != 255 && b2 != 255
43}
diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go
deleted file mode 100644
index 5232b48..0000000
--- a/vendor/github.com/google/uuid/uuid.go
+++ /dev/null
@@ -1,365 +0,0 @@
1// Copyright 2018 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "bytes"
9 "crypto/rand"
10 "encoding/hex"
11 "errors"
12 "fmt"
13 "io"
14 "strings"
15 "sync"
16)
17
18// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
19// 4122.
20type UUID [16]byte
21
22// A Version represents a UUID's version.
23type Version byte
24
25// A Variant represents a UUID's variant.
26type Variant byte
27
28// Constants returned by Variant.
29const (
30 Invalid = Variant(iota) // Invalid UUID
31 RFC4122 // The variant specified in RFC4122
32 Reserved // Reserved, NCS backward compatibility.
33 Microsoft // Reserved, Microsoft Corporation backward compatibility.
34 Future // Reserved for future definition.
35)
36
37const randPoolSize = 16 * 16
38
39var (
40 rander = rand.Reader // random function
41 poolEnabled = false
42 poolMu sync.Mutex
43 poolPos = randPoolSize // protected with poolMu
44 pool [randPoolSize]byte // protected with poolMu
45)
46
47type invalidLengthError struct{ len int }
48
49func (err invalidLengthError) Error() string {
50 return fmt.Sprintf("invalid UUID length: %d", err.len)
51}
52
53// IsInvalidLengthError is matcher function for custom error invalidLengthError
54func IsInvalidLengthError(err error) bool {
55 _, ok := err.(invalidLengthError)
56 return ok
57}
58
59// 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
61// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
62// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition,
63// Parse accepts non-standard strings such as the raw hex encoding
64// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and 38 byte "Microsoft style" encodings,
65// e.g. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Only the middle 36 bytes are
66// examined in the latter case. Parse should not be used to validate strings as
67// it parses non-standard encodings as indicated above.
68func Parse(s string) (UUID, error) {
69 var uuid UUID
70 switch len(s) {
71 // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
72 case 36:
73
74 // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
75 case 36 + 9:
76 if !strings.EqualFold(s[:9], "urn:uuid:") {
77 return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9])
78 }
79 s = s[9:]
80
81 // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
82 case 36 + 2:
83 s = s[1:]
84
85 // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
86 case 32:
87 var ok bool
88 for i := range uuid {
89 uuid[i], ok = xtob(s[i*2], s[i*2+1])
90 if !ok {
91 return uuid, errors.New("invalid UUID format")
92 }
93 }
94 return uuid, nil
95 default:
96 return uuid, invalidLengthError{len(s)}
97 }
98 // s is now at least 36 bytes long
99 // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
100 if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
101 return uuid, errors.New("invalid UUID format")
102 }
103 for i, x := range [16]int{
104 0, 2, 4, 6,
105 9, 11,
106 14, 16,
107 19, 21,
108 24, 26, 28, 30, 32, 34,
109 } {
110 v, ok := xtob(s[x], s[x+1])
111 if !ok {
112 return uuid, errors.New("invalid UUID format")
113 }
114 uuid[i] = v
115 }
116 return uuid, nil
117}
118
119// ParseBytes is like Parse, except it parses a byte slice instead of a string.
120func ParseBytes(b []byte) (UUID, error) {
121 var uuid UUID
122 switch len(b) {
123 case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
124 case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
125 if !bytes.EqualFold(b[:9], []byte("urn:uuid:")) {
126 return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9])
127 }
128 b = b[9:]
129 case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
130 b = b[1:]
131 case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
132 var ok bool
133 for i := 0; i < 32; i += 2 {
134 uuid[i/2], ok = xtob(b[i], b[i+1])
135 if !ok {
136 return uuid, errors.New("invalid UUID format")
137 }
138 }
139 return uuid, nil
140 default:
141 return uuid, invalidLengthError{len(b)}
142 }
143 // s is now at least 36 bytes long
144 // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
145 if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' {
146 return uuid, errors.New("invalid UUID format")
147 }
148 for i, x := range [16]int{
149 0, 2, 4, 6,
150 9, 11,
151 14, 16,
152 19, 21,
153 24, 26, 28, 30, 32, 34,
154 } {
155 v, ok := xtob(b[x], b[x+1])
156 if !ok {
157 return uuid, errors.New("invalid UUID format")
158 }
159 uuid[i] = v
160 }
161 return uuid, nil
162}
163
164// MustParse is like Parse but panics if the string cannot be parsed.
165// It simplifies safe initialization of global variables holding compiled UUIDs.
166func MustParse(s string) UUID {
167 uuid, err := Parse(s)
168 if err != nil {
169 panic(`uuid: Parse(` + s + `): ` + err.Error())
170 }
171 return uuid
172}
173
174// FromBytes creates a new UUID from a byte slice. Returns an error if the slice
175// does not have a length of 16. The bytes are copied from the slice.
176func FromBytes(b []byte) (uuid UUID, err error) {
177 err = uuid.UnmarshalBinary(b)
178 return uuid, err
179}
180
181// Must returns uuid if err is nil and panics otherwise.
182func Must(uuid UUID, err error) UUID {
183 if err != nil {
184 panic(err)
185 }
186 return uuid
187}
188
189// Validate returns an error if s is not a properly formatted UUID in one of the following formats:
190// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
191// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
192// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
193// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
194// It returns an error if the format is invalid, otherwise nil.
195func Validate(s string) error {
196 switch len(s) {
197 // Standard UUID format
198 case 36:
199
200 // UUID with "urn:uuid:" prefix
201 case 36 + 9:
202 if !strings.EqualFold(s[:9], "urn:uuid:") {
203 return fmt.Errorf("invalid urn prefix: %q", s[:9])
204 }
205 s = s[9:]
206
207 // UUID enclosed in braces
208 case 36 + 2:
209 if s[0] != '{' || s[len(s)-1] != '}' {
210 return fmt.Errorf("invalid bracketed UUID format")
211 }
212 s = s[1 : len(s)-1]
213
214 // UUID without hyphens
215 case 32:
216 for i := 0; i < len(s); i += 2 {
217 _, ok := xtob(s[i], s[i+1])
218 if !ok {
219 return errors.New("invalid UUID format")
220 }
221 }
222
223 default:
224 return invalidLengthError{len(s)}
225 }
226
227 // Check for standard UUID format
228 if len(s) == 36 {
229 if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
230 return errors.New("invalid UUID format")
231 }
232 for _, x := range []int{0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} {
233 if _, ok := xtob(s[x], s[x+1]); !ok {
234 return errors.New("invalid UUID format")
235 }
236 }
237 }
238
239 return nil
240}
241
242// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
243// , or "" if uuid is invalid.
244func (uuid UUID) String() string {
245 var buf [36]byte
246 encodeHex(buf[:], uuid)
247 return string(buf[:])
248}
249
250// URN returns the RFC 2141 URN form of uuid,
251// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.
252func (uuid UUID) URN() string {
253 var buf [36 + 9]byte
254 copy(buf[:], "urn:uuid:")
255 encodeHex(buf[9:], uuid)
256 return string(buf[:])
257}
258
259func encodeHex(dst []byte, uuid UUID) {
260 hex.Encode(dst, uuid[:4])
261 dst[8] = '-'
262 hex.Encode(dst[9:13], uuid[4:6])
263 dst[13] = '-'
264 hex.Encode(dst[14:18], uuid[6:8])
265 dst[18] = '-'
266 hex.Encode(dst[19:23], uuid[8:10])
267 dst[23] = '-'
268 hex.Encode(dst[24:], uuid[10:])
269}
270
271// Variant returns the variant encoded in uuid.
272func (uuid UUID) Variant() Variant {
273 switch {
274 case (uuid[8] & 0xc0) == 0x80:
275 return RFC4122
276 case (uuid[8] & 0xe0) == 0xc0:
277 return Microsoft
278 case (uuid[8] & 0xe0) == 0xe0:
279 return Future
280 default:
281 return Reserved
282 }
283}
284
285// Version returns the version of uuid.
286func (uuid UUID) Version() Version {
287 return Version(uuid[6] >> 4)
288}
289
290func (v Version) String() string {
291 if v > 15 {
292 return fmt.Sprintf("BAD_VERSION_%d", v)
293 }
294 return fmt.Sprintf("VERSION_%d", v)
295}
296
297func (v Variant) String() string {
298 switch v {
299 case RFC4122:
300 return "RFC4122"
301 case Reserved:
302 return "Reserved"
303 case Microsoft:
304 return "Microsoft"
305 case Future:
306 return "Future"
307 case Invalid:
308 return "Invalid"
309 }
310 return fmt.Sprintf("BadVariant%d", int(v))
311}
312
313// SetRand sets the random number generator to r, which implements io.Reader.
314// If r.Read returns an error when the package requests random data then
315// a panic will be issued.
316//
317// Calling SetRand with nil sets the random number generator to the default
318// generator.
319func SetRand(r io.Reader) {
320 if r == nil {
321 rander = rand.Reader
322 return
323 }
324 rander = r
325}
326
327// EnableRandPool enables internal randomness pool used for Random
328// (Version 4) UUID generation. The pool contains random bytes read from
329// the random number generator on demand in batches. Enabling the pool
330// may improve the UUID generation throughput significantly.
331//
332// Since the pool is stored on the Go heap, this feature may be a bad fit
333// for security sensitive applications.
334//
335// Both EnableRandPool and DisableRandPool are not thread-safe and should
336// only be called when there is no possibility that New or any other
337// UUID Version 4 generation function will be called concurrently.
338func EnableRandPool() {
339 poolEnabled = true
340}
341
342// DisableRandPool disables the randomness pool if it was previously
343// enabled with EnableRandPool.
344//
345// Both EnableRandPool and DisableRandPool are not thread-safe and should
346// only be called when there is no possibility that New or any other
347// UUID Version 4 generation function will be called concurrently.
348func DisableRandPool() {
349 poolEnabled = false
350 defer poolMu.Unlock()
351 poolMu.Lock()
352 poolPos = randPoolSize
353}
354
355// UUIDs is a slice of UUID types.
356type UUIDs []UUID
357
358// Strings returns a string slice containing the string form of each UUID in uuids.
359func (uuids UUIDs) Strings() []string {
360 var uuidStrs = make([]string, len(uuids))
361 for i, uuid := range uuids {
362 uuidStrs[i] = uuid.String()
363 }
364 return uuidStrs
365}
diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go
deleted file mode 100644
index 4631096..0000000
--- a/vendor/github.com/google/uuid/version1.go
+++ /dev/null
@@ -1,44 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "encoding/binary"
9)
10
11// NewUUID returns a Version 1 UUID based on the current NodeID and clock
12// sequence, and the current time. If the NodeID has not been set by SetNodeID
13// or SetNodeInterface then it will be set automatically. If the NodeID cannot
14// be set NewUUID returns nil. If clock sequence has not been set by
15// SetClockSequence then it will be set automatically. If GetTime fails to
16// return the current NewUUID returns nil and an error.
17//
18// In most cases, New should be used.
19func NewUUID() (UUID, error) {
20 var uuid UUID
21 now, seq, err := GetTime()
22 if err != nil {
23 return uuid, err
24 }
25
26 timeLow := uint32(now & 0xffffffff)
27 timeMid := uint16((now >> 32) & 0xffff)
28 timeHi := uint16((now >> 48) & 0x0fff)
29 timeHi |= 0x1000 // Version 1
30
31 binary.BigEndian.PutUint32(uuid[0:], timeLow)
32 binary.BigEndian.PutUint16(uuid[4:], timeMid)
33 binary.BigEndian.PutUint16(uuid[6:], timeHi)
34 binary.BigEndian.PutUint16(uuid[8:], seq)
35
36 nodeMu.Lock()
37 if nodeID == zeroID {
38 setNodeInterface("")
39 }
40 copy(uuid[10:], nodeID[:])
41 nodeMu.Unlock()
42
43 return uuid, nil
44}
diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go
deleted file mode 100644
index 7697802..0000000
--- a/vendor/github.com/google/uuid/version4.go
+++ /dev/null
@@ -1,76 +0,0 @@
1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import "io"
8
9// New creates a new random UUID or panics. New is equivalent to
10// the expression
11//
12// uuid.Must(uuid.NewRandom())
13func New() UUID {
14 return Must(NewRandom())
15}
16
17// NewString creates a new random UUID and returns it as a string or panics.
18// NewString is equivalent to the expression
19//
20// uuid.New().String()
21func NewString() string {
22 return Must(NewRandom()).String()
23}
24
25// NewRandom returns a Random (Version 4) UUID.
26//
27// The strength of the UUIDs is based on the strength of the crypto/rand
28// package.
29//
30// Uses the randomness pool if it was enabled with EnableRandPool.
31//
32// A note about uniqueness derived from the UUID Wikipedia entry:
33//
34// Randomly generated UUIDs have 122 random bits. One's annual risk of being
35// hit by a meteorite is estimated to be one chance in 17 billion, that
36// means the probability is about 0.00000000006 (6 × 10−11),
37// equivalent to the odds of creating a few tens of trillions of UUIDs in a
38// year and having one duplicate.
39func NewRandom() (UUID, error) {
40 if !poolEnabled {
41 return NewRandomFromReader(rander)
42 }
43 return newRandomFromPool()
44}
45
46// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.
47func NewRandomFromReader(r io.Reader) (UUID, error) {
48 var uuid UUID
49 _, err := io.ReadFull(r, uuid[:])
50 if err != nil {
51 return Nil, err
52 }
53 uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
54 uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
55 return uuid, nil
56}
57
58func newRandomFromPool() (UUID, error) {
59 var uuid UUID
60 poolMu.Lock()
61 if poolPos == randPoolSize {
62 _, err := io.ReadFull(rander, pool[:])
63 if err != nil {
64 poolMu.Unlock()
65 return Nil, err
66 }
67 poolPos = 0
68 }
69 copy(uuid[:], pool[poolPos:(poolPos+16)])
70 poolPos += 16
71 poolMu.Unlock()
72
73 uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
74 uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
75 return uuid, nil
76}
diff --git a/vendor/github.com/google/uuid/version6.go b/vendor/github.com/google/uuid/version6.go
deleted file mode 100644
index 339a959..0000000
--- a/vendor/github.com/google/uuid/version6.go
+++ /dev/null
@@ -1,56 +0,0 @@
1// Copyright 2023 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import "encoding/binary"
8
9// UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality.
10// It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs.
11// Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead.
12//
13// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#uuidv6
14//
15// NewV6 returns a Version 6 UUID based on the current NodeID and clock
16// sequence, and the current time. If the NodeID has not been set by SetNodeID
17// or SetNodeInterface then it will be set automatically. If the NodeID cannot
18// be set NewV6 set NodeID is random bits automatically . If clock sequence has not been set by
19// SetClockSequence then it will be set automatically. If GetTime fails to
20// return the current NewV6 returns Nil and an error.
21func NewV6() (UUID, error) {
22 var uuid UUID
23 now, seq, err := GetTime()
24 if err != nil {
25 return uuid, err
26 }
27
28 /*
29 0 1 2 3
30 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
31 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 | time_high |
33 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 | time_mid | time_low_and_version |
35 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 |clk_seq_hi_res | clk_seq_low | node (0-1) |
37 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38 | node (2-5) |
39 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40 */
41
42 binary.BigEndian.PutUint64(uuid[0:], uint64(now))
43 binary.BigEndian.PutUint16(uuid[8:], seq)
44
45 uuid[6] = 0x60 | (uuid[6] & 0x0F)
46 uuid[8] = 0x80 | (uuid[8] & 0x3F)
47
48 nodeMu.Lock()
49 if nodeID == zeroID {
50 setNodeInterface("")
51 }
52 copy(uuid[10:], nodeID[:])
53 nodeMu.Unlock()
54
55 return uuid, nil
56}
diff --git a/vendor/github.com/google/uuid/version7.go b/vendor/github.com/google/uuid/version7.go
deleted file mode 100644
index ba9dd5e..0000000
--- a/vendor/github.com/google/uuid/version7.go
+++ /dev/null
@@ -1,75 +0,0 @@
1// Copyright 2023 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package uuid
6
7import (
8 "io"
9)
10
11// UUID version 7 features a time-ordered value field derived from the widely
12// implemented and well known Unix Epoch timestamp source,
13// the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
14// As well as improved entropy characteristics over versions 1 or 6.
15//
16// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#name-uuid-version-7
17//
18// Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible.
19//
20// NewV7 returns a Version 7 UUID based on the current time(Unix Epoch).
21// Uses the randomness pool if it was enabled with EnableRandPool.
22// On error, NewV7 returns Nil and an error
23func NewV7() (UUID, error) {
24 uuid, err := NewRandom()
25 if err != nil {
26 return uuid, err
27 }
28 makeV7(uuid[:])
29 return uuid, nil
30}
31
32// NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch).
33// it use NewRandomFromReader fill random bits.
34// On error, NewV7FromReader returns Nil and an error.
35func NewV7FromReader(r io.Reader) (UUID, error) {
36 uuid, err := NewRandomFromReader(r)
37 if err != nil {
38 return uuid, err
39 }
40
41 makeV7(uuid[:])
42 return uuid, nil
43}
44
45// makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6])
46// uuid[8] already has the right version number (Variant is 10)
47// see function NewV7 and NewV7FromReader
48func makeV7(uuid []byte) {
49 /*
50 0 1 2 3
51 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
52 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 | unix_ts_ms |
54 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
55 | unix_ts_ms | ver | rand_a |
56 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57 |var| rand_b |
58 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59 | rand_b |
60 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61 */
62 _ = uuid[15] // bounds check
63
64 t := timeNow().UnixMilli()
65
66 uuid[0] = byte(t >> 40)
67 uuid[1] = byte(t >> 32)
68 uuid[2] = byte(t >> 24)
69 uuid[3] = byte(t >> 16)
70 uuid[4] = byte(t >> 8)
71 uuid[5] = byte(t)
72
73 uuid[6] = 0x70 | (uuid[6] & 0x0F)
74 // uuid[8] has already has right version
75}