From 18f52af5be3a9a0c73811706108f790d65ee9c67 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Mon, 29 Nov 2021 01:46:27 +0100 Subject: [pkg] update vendor --- vendor/github.com/pion/randutil/.travis.yml | 142 ++++++++++++++++++++++++++ vendor/github.com/pion/randutil/LICENSE | 21 ++++ vendor/github.com/pion/randutil/README.md | 14 +++ vendor/github.com/pion/randutil/codecov.yml | 20 ++++ vendor/github.com/pion/randutil/crypto.go | 30 ++++++ vendor/github.com/pion/randutil/go.mod | 3 + vendor/github.com/pion/randutil/math.go | 72 +++++++++++++ vendor/github.com/pion/randutil/renovate.json | 15 +++ 8 files changed, 317 insertions(+) create mode 100644 vendor/github.com/pion/randutil/.travis.yml create mode 100644 vendor/github.com/pion/randutil/LICENSE create mode 100644 vendor/github.com/pion/randutil/README.md create mode 100644 vendor/github.com/pion/randutil/codecov.yml create mode 100644 vendor/github.com/pion/randutil/crypto.go create mode 100644 vendor/github.com/pion/randutil/go.mod create mode 100644 vendor/github.com/pion/randutil/math.go create mode 100644 vendor/github.com/pion/randutil/renovate.json (limited to 'vendor/github.com/pion/randutil') diff --git a/vendor/github.com/pion/randutil/.travis.yml b/vendor/github.com/pion/randutil/.travis.yml new file mode 100644 index 0000000..f04a896 --- /dev/null +++ b/vendor/github.com/pion/randutil/.travis.yml @@ -0,0 +1,142 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically copied from https://github.com/pion/.goassets repository. +# If this repository should have package specific CI config, +# remove the repository name from .goassets/.github/workflows/assets-sync.yml. +# +# If you want to update the shared CI config, send a PR to +# https://github.com/pion/.goassets instead of this repository. +# + +dist: bionic +language: go + + +branches: + only: + - master + +env: + global: + - GO111MODULE=on + - GOLANGCI_LINT_VERSION=1.19.1 + +cache: + directories: + - ${HOME}/.cache/go-build + - ${GOPATH}/pkg/mod + npm: true + yarn: true + +_lint_job: &lint_job + env: CACHE_NAME=lint + before_install: + - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi + install: skip + before_script: + - | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ + | bash -s - -b $GOPATH/bin v${GOLANGCI_LINT_VERSION} + script: + - bash .github/assert-contributors.sh + - bash .github/lint-disallowed-functions-in-library.sh + - bash .github/lint-commit-message.sh + - bash .github/lint-filename.sh + - golangci-lint run ./... +_test_job: &test_job + env: CACHE_NAME=test + before_install: + - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi + - go mod download + install: + - go build ./... + script: + # If you want to specify repository specific test packages rule, + # add `TEST_PACKAGES=$(command to list test target packages)` to .github/.ci.conf + - testpkgs=${TEST_PACKAGES:-$(go list ./... | grep -v examples)} + - coverpkgs=$(echo "${testpkgs}" | paste -s -d ',') + - | + go test \ + -coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \ + ${TEST_EXTRA_ARGS:-} \ + -v -race ${testpkgs} + - if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi + after_success: + - travis_retry bash <(curl -s https://codecov.io/bash) -c -F go +_test_i386_job: &test_i386_job + env: CACHE_NAME=test386 + services: docker + before_install: + - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi + script: + - testpkgs=${TEST_PACKAGES:-$(go list ./... | grep -v examples)} + - | + docker run \ + -u $(id -u):$(id -g) \ + -e "GO111MODULE=on" \ + -e "CGO_ENABLED=0" \ + -v ${PWD}:/go/src/github.com/pion/$(basename ${PWD}) \ + -v ${HOME}/gopath/pkg/mod:/go/pkg/mod \ + -v ${HOME}/.cache/go-build:/.cache/go-build \ + -w /go/src/github.com/pion/$(basename ${PWD}) \ + -it i386/golang:${GO_VERSION}-alpine \ + /usr/local/go/bin/go test \ + ${TEST_EXTRA_ARGS:-} \ + -v ${testpkgs} +_test_wasm_job: &test_wasm_job + env: CACHE_NAME=wasm + language: node_js + node_js: 12 + before_install: + - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi + - if ${SKIP_WASM_TEST:-false}; then exit 0; fi + install: + # Manually download and install Go instead of using gimme. + # It looks like gimme Go causes some errors on go-test for Wasm. + - curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf - + - export GOROOT=${HOME}/go + - export PATH=${GOROOT}/bin:${PATH} + - yarn install + - export GO_JS_WASM_EXEC=${GO_JS_WASM_EXEC:-${GOROOT}/misc/wasm/go_js_wasm_exec} + script: + - testpkgs=${TEST_PACKAGES:-$(go list ./... | grep -v examples)} + - coverpkgs=$(echo "${testpkgs}" | paste -s -d ',') + - | + GOOS=js GOARCH=wasm go test \ + -coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \ + -exec="${GO_JS_WASM_EXEC}" \ + -v ${testpkgs} + after_success: + - travis_retry bash <(curl -s https://codecov.io/bash) -c -F wasm + +jobs: + include: + - <<: *lint_job + name: Lint 1.14 + go: 1.14 + - <<: *test_job + name: Test 1.13 + go: 1.13 + - <<: *test_job + name: Test 1.14 + go: 1.14 + - <<: *test_i386_job + name: Test i386 1.13 + env: GO_VERSION=1.13 + go: 1.14 # Go version for host environment only for `go list`. + # All tests are done on the version specified by GO_VERSION. + - <<: *test_i386_job + name: Test i386 1.14 + env: GO_VERSION=1.14 + go: 1.14 # Go version for host environment only for `go list`. + # All tests are done on the version specified by GO_VERSION. + - <<: *test_wasm_job + name: Test WASM 1.13 + env: GO_VERSION=1.13 + - <<: *test_wasm_job + name: Test WASM 1.14 + env: GO_VERSION=1.14 + +notifications: + email: false diff --git a/vendor/github.com/pion/randutil/LICENSE b/vendor/github.com/pion/randutil/LICENSE new file mode 100644 index 0000000..5b5a394 --- /dev/null +++ b/vendor/github.com/pion/randutil/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Pion + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/pion/randutil/README.md b/vendor/github.com/pion/randutil/README.md new file mode 100644 index 0000000..94baf77 --- /dev/null +++ b/vendor/github.com/pion/randutil/README.md @@ -0,0 +1,14 @@ +# randutil +Helper library for cryptographic and mathmatical randoms + +### Community +Pion has an active community on the [Golang Slack](https://invite.slack.golangbridge.org/). Sign up and join the **#pion** channel for discussions and support. You can also use [Pion mailing list](https://groups.google.com/forum/#!forum/pion). + +We are always looking to support **your projects**. Please reach out if you have something to build! + +If you need commercial support or don't want to use public methods you can contact us at [team@pion.ly](mailto:team@pion.ly) + +### Contributing +Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contributing)** to join the group of amazing people making this project possible: + +* [Atsushi Watanabe](https://github.com/at-wat) - *Original Author* diff --git a/vendor/github.com/pion/randutil/codecov.yml b/vendor/github.com/pion/randutil/codecov.yml new file mode 100644 index 0000000..085200a --- /dev/null +++ b/vendor/github.com/pion/randutil/codecov.yml @@ -0,0 +1,20 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically copied from https://github.com/pion/.goassets repository. +# + +coverage: + status: + project: + default: + # Allow decreasing 2% of total coverage to avoid noise. + threshold: 2% + patch: + default: + target: 70% + only_pulls: true + +ignore: + - "examples/*" + - "examples/**/*" diff --git a/vendor/github.com/pion/randutil/crypto.go b/vendor/github.com/pion/randutil/crypto.go new file mode 100644 index 0000000..d10df98 --- /dev/null +++ b/vendor/github.com/pion/randutil/crypto.go @@ -0,0 +1,30 @@ +package randutil + +import ( + crand "crypto/rand" + "encoding/binary" + "math/big" +) + +// GenerateCryptoRandomString generates a random string for cryptographic usage. +func GenerateCryptoRandomString(n int, runes string) (string, error) { + letters := []rune(runes) + b := make([]rune, n) + for i := range b { + v, err := crand.Int(crand.Reader, big.NewInt(int64(len(letters)))) + if err != nil { + return "", err + } + b[i] = letters[v.Int64()] + } + return string(b), nil +} + +// CryptoUint64 returns cryptographic random uint64. +func CryptoUint64() (uint64, error) { + var v uint64 + if err := binary.Read(crand.Reader, binary.LittleEndian, &v); err != nil { + return 0, err + } + return v, nil +} diff --git a/vendor/github.com/pion/randutil/go.mod b/vendor/github.com/pion/randutil/go.mod new file mode 100644 index 0000000..2a824e0 --- /dev/null +++ b/vendor/github.com/pion/randutil/go.mod @@ -0,0 +1,3 @@ +module github.com/pion/randutil + +go 1.14 diff --git a/vendor/github.com/pion/randutil/math.go b/vendor/github.com/pion/randutil/math.go new file mode 100644 index 0000000..fbbf460 --- /dev/null +++ b/vendor/github.com/pion/randutil/math.go @@ -0,0 +1,72 @@ +package randutil + +import ( + mrand "math/rand" // used for non-crypto unique ID and random port selection + "sync" + "time" +) + +// MathRandomGenerator is a random generator for non-crypto usage. +type MathRandomGenerator interface { + // Intn returns random integer within [0:n). + Intn(n int) int + + // Uint32 returns random 32-bit unsigned integer. + Uint32() uint32 + + // Uint64 returns random 64-bit unsigned integer. + Uint64() uint64 + + // GenerateString returns ranom string using given set of runes. + // It can be used for generating unique ID to avoid name collision. + // + // Caution: DO NOT use this for cryptographic usage. + GenerateString(n int, runes string) string +} + +type mathRandomGenerator struct { + r *mrand.Rand + mu sync.Mutex +} + +// NewMathRandomGenerator creates new mathmatical random generator. +// Random generator is seeded by crypto random. +func NewMathRandomGenerator() MathRandomGenerator { + seed, err := CryptoUint64() + if err != nil { + // crypto/rand is unavailable. Fallback to seed by time. + seed = uint64(time.Now().UnixNano()) + } + + return &mathRandomGenerator{r: mrand.New(mrand.NewSource(int64(seed)))} +} + +func (g *mathRandomGenerator) Intn(n int) int { + g.mu.Lock() + v := g.r.Intn(n) + g.mu.Unlock() + return v +} + +func (g *mathRandomGenerator) Uint32() uint32 { + g.mu.Lock() + v := g.r.Uint32() + g.mu.Unlock() + return v +} + +func (g *mathRandomGenerator) Uint64() uint64 { + g.mu.Lock() + v := g.r.Uint64() + g.mu.Unlock() + return v +} + +func (g *mathRandomGenerator) GenerateString(n int, runes string) string { + letters := []rune(runes) + b := make([]rune, n) + for i := range b { + b[i] = letters[g.Intn(len(letters))] + } + return string(b) +} diff --git a/vendor/github.com/pion/randutil/renovate.json b/vendor/github.com/pion/randutil/renovate.json new file mode 100644 index 0000000..4400fd9 --- /dev/null +++ b/vendor/github.com/pion/randutil/renovate.json @@ -0,0 +1,15 @@ +{ + "extends": [ + "config:base" + ], + "postUpdateOptions": [ + "gomodTidy" + ], + "commitBody": "Generated by renovateBot", + "packageRules": [ + { + "packagePatterns": ["^golang.org/x/"], + "schedule": ["on the first day of the month"] + } + ] +} -- cgit v1.2.3