diff --git a/src/data/payloads.go b/src/data/payloads.go index 973a88f..f518dc4 100644 --- a/src/data/payloads.go +++ b/src/data/payloads.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/google/uuid" + gonanoid "github.com/matoous/go-nanoid/v2" "github.com/pkg/errors" "github.com/rs/zerolog" ) @@ -167,9 +167,9 @@ func (s *PayloadsStore) Count() int { return len(s.content) } -func getRandomUUID() string { - rawId, _ := uuid.NewRandom() - return rawId.String() +func getUniqueID() string { + id, _ := gonanoid.New() + return id } func (s *PayloadsStore) createTempFile(src io.ReadCloser) (string, int64, error) { @@ -192,7 +192,7 @@ func (s *PayloadsStore) createTempFile(src io.ReadCloser) (string, int64, error) // InsertFile implements FileStore func (s *PayloadsStore) InsertFile(name string, src io.ReadCloser) (string, error) { - id := getRandomUUID() + id := getUniqueID() filename, size, err := s.createTempFile(src) if err != nil { diff --git a/src/go.mod b/src/go.mod index 21cb755..fd93bb6 100644 --- a/src/go.mod +++ b/src/go.mod @@ -6,7 +6,7 @@ require ( github.com/Icikowski/kubeprobes v1.2.0 github.com/caarlos0/env/v6 v6.10.1 github.com/go-chi/chi/v5 v5.0.7 - github.com/google/uuid v1.3.0 + github.com/matoous/go-nanoid/v2 v2.0.0 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.28.0 github.com/stretchr/testify v1.8.1 diff --git a/src/go.sum b/src/go.sum index bcc30dd..710b2f1 100644 --- a/src/go.sum +++ b/src/go.sum @@ -9,8 +9,9 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8= github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/matoous/go-nanoid v1.5.0/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U= +github.com/matoous/go-nanoid/v2 v2.0.0 h1:d19kur2QuLeHmJBkvYkFdhFBzLoo1XVm2GgTpL+9Tj0= +github.com/matoous/go-nanoid/v2 v2.0.0/go.mod h1:FtS4aGPVfEkxKxhdWPAspZpZSh1cOjtM7Ej/So3hR0g= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=