diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 890e606..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,330 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d" - name = "github.com/beorn7/perks" - packages = ["quantile"] - pruneopts = "UT" - revision = "3a771d992973f24aa725d07868b467d1ddfceafb" - -[[projects]] - digest = "1:abeb38ade3f32a92943e5be54f55ed6d6e3b6602761d74b4aab4c9dd45c18abd" - name = "github.com/fsnotify/fsnotify" - packages = ["."] - pruneopts = "UT" - revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" - version = "v1.4.7" - -[[projects]] - digest = "1:318f1c959a8a740366fce4b1e1eb2fd914036b4af58fbd0a003349b305f118ad" - name = "github.com/golang/protobuf" - packages = ["proto"] - pruneopts = "UT" - revision = "c823c79ea1570fb5ff454033735a8e68575d1d0f" - version = "v1.3.0" - -[[projects]] - digest = "1:919da3b8fb3ce3cc5727081078417c95fabb7070c995e4305ab889099c476174" - name = "github.com/gortc/ice" - packages = [ - ".", - "candidate", - "gather", - "internal", - "sdp", - ] - pruneopts = "UT" - revision = "0502d448b37789b0bed1d54ccd0adefaa9cefca0" - version = "v0.6.3" - -[[projects]] - digest = "1:4e01f79919d7c4a558229a4e33f4e89aa19b1d9bbbbace348becf9e54b3d14a7" - name = "github.com/gortc/stun" - packages = [ - ".", - "internal/hmac", - ] - pruneopts = "UT" - revision = "3c40912f48996d590b9fa5be490612e49b2bb5ba" - version = "v1.19.0" - -[[projects]] - digest = "1:b727140997993a29c318c421ed1e559744c17ea6756af67ce608237730144f5a" - name = "github.com/gortc/turn" - packages = ["."] - pruneopts = "UT" - revision = "ab450b60e25e0b0188a9337b18e8e144b910e845" - version = "v0.6.7" - -[[projects]] - digest = "1:c0d19ab64b32ce9fe5cf4ddceba78d5bc9807f0016db6b1183599da3dcc24d10" - name = "github.com/hashicorp/hcl" - packages = [ - ".", - "hcl/ast", - "hcl/parser", - "hcl/printer", - "hcl/scanner", - "hcl/strconv", - "hcl/token", - "json/parser", - "json/scanner", - "json/token", - ] - pruneopts = "UT" - revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" - version = "v1.0.0" - -[[projects]] - digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be" - name = "github.com/inconshreveable/mousetrap" - packages = ["."] - pruneopts = "UT" - revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" - version = "v1.0" - -[[projects]] - digest = "1:3218d9edf75d814d2994ce4b14fae01c657a3284af84522efcc8dee89806f4ca" - name = "github.com/libp2p/go-reuseport" - packages = ["."] - pruneopts = "UT" - revision = "3e6d618acfdfacbbeff71cb2bd70fc188f897a0f" - version = "v0.0.1" - -[[projects]] - digest = "1:c568d7727aa262c32bdf8a3f7db83614f7af0ed661474b24588de635c20024c7" - name = "github.com/magiconair/properties" - packages = ["."] - pruneopts = "UT" - revision = "c2353362d570a7bfa228149c62842019201cfb71" - version = "v1.8.0" - -[[projects]] - digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" - name = "github.com/matttproud/golang_protobuf_extensions" - packages = ["pbutil"] - pruneopts = "UT" - revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" - version = "v1.0.1" - -[[projects]] - digest = "1:5d231480e1c64a726869bc4142d270184c419749d34f167646baa21008eb0a79" - name = "github.com/mitchellh/go-homedir" - packages = ["."] - pruneopts = "UT" - revision = "af06845cf3004701891bf4fdb884bfe4920b3727" - version = "v1.1.0" - -[[projects]] - digest = "1:53bc4cd4914cd7cd52139990d5170d6dc99067ae31c56530621b18b35fc30318" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - pruneopts = "UT" - revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe" - version = "v1.1.2" - -[[projects]] - digest = "1:95741de3af260a92cc5c7f3f3061e85273f5a81b5db20d4bd68da74bd521675e" - name = "github.com/pelletier/go-toml" - packages = ["."] - pruneopts = "UT" - revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194" - version = "v1.2.0" - -[[projects]] - digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b" - name = "github.com/pkg/errors" - packages = ["."] - pruneopts = "UT" - revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" - version = "v0.8.1" - -[[projects]] - digest = "1:93a746f1060a8acbcf69344862b2ceced80f854170e1caae089b2834c5fbf7f4" - name = "github.com/prometheus/client_golang" - packages = [ - "prometheus", - "prometheus/internal", - "prometheus/promhttp", - ] - pruneopts = "UT" - revision = "505eaef017263e299324067d40ca2c48f6a2cf50" - version = "v0.9.2" - -[[projects]] - branch = "master" - digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4" - name = "github.com/prometheus/client_model" - packages = ["go"] - pruneopts = "UT" - revision = "fd36f4220a901265f90734c3183c5f0c91daa0b8" - -[[projects]] - digest = "1:35cf6bdf68db765988baa9c4f10cc5d7dda1126a54bd62e252dbcd0b1fc8da90" - name = "github.com/prometheus/common" - packages = [ - "expfmt", - "internal/bitbucket.org/ww/goautoneg", - "model", - ] - pruneopts = "UT" - revision = "cfeb6f9992ffa54aaa4f2170ade4067ee478b250" - version = "v0.2.0" - -[[projects]] - branch = "master" - digest = "1:01cd0cd47758f04c5604daa3be4637e2afa1e0c15af7e08289e95360369e4f48" - name = "github.com/prometheus/procfs" - packages = [ - ".", - "internal/util", - "iostats", - "nfs", - "xfs", - ] - pruneopts = "UT" - revision = "d0f344d83b0c80a1bc03b547a2374a9ec6711144" - -[[projects]] - digest = "1:3e39bafd6c2f4bf3c76c3bfd16a2e09e016510ad5db90dc02b88e2f565d6d595" - name = "github.com/spf13/afero" - packages = [ - ".", - "mem", - ] - pruneopts = "UT" - revision = "f4711e4db9e9a1d3887343acb72b2bbfc2f686f5" - version = "v1.2.1" - -[[projects]] - digest = "1:08d65904057412fc0270fc4812a1c90c594186819243160dc779a402d4b6d0bc" - name = "github.com/spf13/cast" - packages = ["."] - pruneopts = "UT" - revision = "8c9545af88b134710ab1cd196795e7f2388358d7" - version = "v1.3.0" - -[[projects]] - digest = "1:645cabccbb4fa8aab25a956cbcbdf6a6845ca736b2c64e197ca7cbb9d210b939" - name = "github.com/spf13/cobra" - packages = ["."] - pruneopts = "UT" - revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" - version = "v0.0.3" - -[[projects]] - digest = "1:1b753ec16506f5864d26a28b43703c58831255059644351bbcb019b843950900" - name = "github.com/spf13/jwalterweatherman" - packages = ["."] - pruneopts = "UT" - revision = "94f6ae3ed3bceceafa716478c5fbf8d29ca601a1" - version = "v1.1.0" - -[[projects]] - digest = "1:c1b1102241e7f645bc8e0c22ae352e8f0dc6484b6cb4d132fa9f24174e0119e2" - name = "github.com/spf13/pflag" - packages = ["."] - pruneopts = "UT" - revision = "298182f68c66c05229eb03ac171abe6e309ee79a" - version = "v1.0.3" - -[[projects]] - digest = "1:de37e343c64582d7026bf8ab6ac5b22a72eac54f3a57020db31524affed9f423" - name = "github.com/spf13/viper" - packages = ["."] - pruneopts = "UT" - revision = "6d33b5a963d922d182c91e8a1c88d81fd150cfd4" - version = "v1.3.1" - -[[projects]] - digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" - name = "go.uber.org/atomic" - packages = ["."] - pruneopts = "UT" - revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" - version = "v1.3.2" - -[[projects]] - digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a" - name = "go.uber.org/multierr" - packages = ["."] - pruneopts = "UT" - revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a" - version = "v1.1.0" - -[[projects]] - digest = "1:2a1fe9905518611e9ce56cd7aaefb35fca78d8a721ef5eb6540e5fdd436f45bb" - name = "go.uber.org/zap" - packages = [ - ".", - "buffer", - "internal/bufferpool", - "internal/color", - "internal/exit", - "zapcore", - "zaptest/observer", - ] - pruneopts = "UT" - revision = "27376062155ad36be76b0f12cf1572a221d3a48c" - version = "v1.10.0" - -[[projects]] - branch = "master" - digest = "1:c15b180a35d04dcbb9a98fe7e453be2438f6f8e9a719c41294141a6390d641d4" - name = "golang.org/x/sys" - packages = [ - "unix", - "windows", - ] - pruneopts = "UT" - revision = "980fc434d28e11f0a5c1ae102a263b8c56641011" - -[[projects]] - digest = "1:8029e9743749d4be5bc9f7d42ea1659471767860f0cdc34d37c3111bd308a295" - name = "golang.org/x/text" - packages = [ - "internal/gen", - "internal/triegen", - "internal/ucd", - "transform", - "unicode/cldr", - "unicode/norm", - ] - pruneopts = "UT" - revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" - version = "v0.3.0" - -[[projects]] - digest = "1:4d2e5a73dc1500038e504a8d78b986630e3626dc027bc030ba5c75da257cdb96" - name = "gopkg.in/yaml.v2" - packages = ["."] - pruneopts = "UT" - revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" - version = "v2.2.2" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/gortc/ice", - "github.com/gortc/stun", - "github.com/gortc/turn", - "github.com/libp2p/go-reuseport", - "github.com/mitchellh/go-homedir", - "github.com/pkg/errors", - "github.com/prometheus/client_golang/prometheus", - "github.com/prometheus/client_golang/prometheus/promhttp", - "github.com/prometheus/client_model/go", - "github.com/prometheus/common/expfmt", - "github.com/spf13/cobra", - "github.com/spf13/pflag", - "github.com/spf13/viper", - "go.uber.org/zap", - "go.uber.org/zap/zapcore", - "go.uber.org/zap/zaptest/observer", - "gopkg.in/yaml.v2", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 3505b39..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,47 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - -ignored = ["github.com/chromedp/chromedp","github.com/chromedp/chromedp/runner","github.com/gorilla/websocket"] - -[[constraint]] - name = "github.com/gortc/stun" - version = "1.18.2" - -[[constraint]] - name = "github.com/pkg/errors" - version = "0.8.0" - -[[constraint]] - name = "go.uber.org/zap" - version = "1.10" - -[[constraint]] - name = "github.com/gortc/turn" - version = "0.6.7" - -[[constraint]] - name = "github.com/gortc/ice" - version = "0.6" - -[prune] - go-tests = true - unused-packages = true diff --git a/e2e/coturn-client/go.mod b/e2e/coturn-client/go.mod new file mode 100644 index 0000000..4e44edc --- /dev/null +++ b/e2e/coturn-client/go.mod @@ -0,0 +1,5 @@ +module github.com/gortc/gortcd/e2e/coturn-client + +go 1.12 + +require github.com/gortc/stun v1.19.0 diff --git a/e2e/coturn-client/go.sum b/e2e/coturn-client/go.sum new file mode 100644 index 0000000..0ce9b9d --- /dev/null +++ b/e2e/coturn-client/go.sum @@ -0,0 +1,2 @@ +github.com/gortc/stun v1.19.0 h1:6qy7zGGk0tdMOdEzK7hLeAVZEHllJC8+OOBpPAyjY1c= +github.com/gortc/stun v1.19.0/go.mod h1:dZ0O/fYCkg9Z0Pvl6WDpNhRFTAU0X1CPOsJiZqn6EHo= diff --git a/e2e/gortc-turn/turn-client/Gopkg.lock b/e2e/gortc-turn/turn-client/Gopkg.lock deleted file mode 100644 index 8956a7c..0000000 --- a/e2e/gortc-turn/turn-client/Gopkg.lock +++ /dev/null @@ -1,63 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:9eea710c689d8779906c7c8be68450fe547b2c035901277e4f806a7a0b8dad73" - name = "github.com/gortc/stun" - packages = [ - ".", - "internal/hmac", - ] - pruneopts = "UT" - revision = "382848e43da1af4a877b8e1c9374073168749f27" - version = "v1.17.2" - -[[projects]] - digest = "1:23026e48447810c74917745cbec993620f625396a3c88290bd27b273abc51dff" - name = "github.com/gortc/turn" - packages = ["."] - pruneopts = "UT" - revision = "5935d57d0beb0d75a51287fdcea64a493479b691" - version = "v0.5.3" - -[[projects]] - digest = "1:777e729b475d3895c7229552aa10076f0d177daf37c0a72258006d046d329960" - name = "go.uber.org/atomic" - packages = ["."] - pruneopts = "UT" - revision = "4e336646b2ef9fc6e47be8e21594178f98e5ebcf" - version = "v1.2.0" - -[[projects]] - digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a" - name = "go.uber.org/multierr" - packages = ["."] - pruneopts = "UT" - revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a" - version = "v1.1.0" - -[[projects]] - digest = "1:c52caf7bd44f92e54627a31b85baf06a68333a196b3d8d241480a774733dcf8b" - name = "go.uber.org/zap" - packages = [ - ".", - "buffer", - "internal/bufferpool", - "internal/color", - "internal/exit", - "zapcore", - ] - pruneopts = "UT" - revision = "ff33455a0e382e8a81d14dd7c922020b6b5e7982" - version = "v1.9.1" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/gortc/turn", - "go.uber.org/zap", - "go.uber.org/zap/zapcore", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/e2e/gortc-turn/turn-client/Gopkg.toml b/e2e/gortc-turn/turn-client/Gopkg.toml deleted file mode 100644 index c83ac84..0000000 --- a/e2e/gortc-turn/turn-client/Gopkg.toml +++ /dev/null @@ -1,38 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" -# -# [prune] -# non-go = false -# go-tests = true -# unused-packages = true - - -[[constraint]] - name = "github.com/gortc/turn" - version = "0.5.3" - -[[constraint]] - name = "go.uber.org/zap" - version = "1.9.1" - -[prune] - go-tests = true - unused-packages = true diff --git a/e2e/gortc-turn/turn-client/go.mod b/e2e/gortc-turn/turn-client/go.mod new file mode 100644 index 0000000..7ea5ad2 --- /dev/null +++ b/e2e/gortc-turn/turn-client/go.mod @@ -0,0 +1,11 @@ +module github.com/gortc/gortcd/e2e/gortc-turn/turn-client + +go 1.12 + +require ( + github.com/gortc/stun v1.17.2 + github.com/gortc/turn v0.5.3 + go.uber.org/atomic v1.2.0 + go.uber.org/multierr v1.1.0 + go.uber.org/zap v1.9.1 +) diff --git a/e2e/gortc-turn/turn-client/go.sum b/e2e/gortc-turn/turn-client/go.sum new file mode 100644 index 0000000..1ca7788 --- /dev/null +++ b/e2e/gortc-turn/turn-client/go.sum @@ -0,0 +1,10 @@ +github.com/gortc/stun v1.17.2 h1:1D9djwheCldBkcalnT1mSHz/7KbtvP8D9h3ts7NoSKY= +github.com/gortc/stun v1.17.2/go.mod h1:dZ0O/fYCkg9Z0Pvl6WDpNhRFTAU0X1CPOsJiZqn6EHo= +github.com/gortc/turn v0.5.3 h1:Kd3BSVpj3WL6KSOm0Hs/RkO9eqoaRdE0Eo63Srm70Ak= +github.com/gortc/turn v0.5.3/go.mod h1:oChREnOebaYgxAmZd5xUS6MkKS/N5mJ9onT5Glv8mT4= +go.uber.org/atomic v1.2.0 h1:yVVGhClJ8Xi1y4TxhJZE6QFPrz76BrzhWA01n47mSFk= +go.uber.org/atomic v1.2.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.codecov.yml b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.codecov.yml deleted file mode 100644 index 7fa67fe..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.codecov.yml +++ /dev/null @@ -1,9 +0,0 @@ -coverage: - status: - patch: off - project: - default: - # basic - target: 98 - threshold: null - base: auto diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.gitignore b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.gitignore deleted file mode 100644 index d062868..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*-fuzz.zip -.idea -benchmark.*.write -*.test -*.out -bench.go-* -PACKAGES -cmd/stun-cli/stun-cli -cmd/stun-decode/stun-decode -cmd/stun-bench/stun-bench - -coverage.txt diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.travis.yml b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.travis.yml deleted file mode 100644 index df2af44..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -sudo: false - -os: - - linux - -go: - - stable - -install: true - -script: - - make test - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/AUTHORS b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/AUTHORS deleted file mode 100644 index 76eabf8..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -Aleksandr Razumov -Aliaksandr Valialkin -The gortc project -The IETF Trust -The Go Authors -backkem (https://github.com/backkem) diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/Dockerfile b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/Dockerfile deleted file mode 100644 index 5e95e8b..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM golang:1.10 - -COPY . /go/src/github.com/gortc/stun - -RUN go test github.com/gortc/stun - diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/LICENSE b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/LICENSE deleted file mode 100644 index 3a812a0..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2013 The Go Authors. All rights reserved. -Copyright (c) 2016-2018 gortc. All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/Makefile b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/Makefile deleted file mode 100644 index e4d63cf..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -VERSION := $(shell git describe --tags | sed -e 's/^v//g' | awk -F "-" '{print $$1}') -ITERATION := $(shell git describe --tags --long | awk -F "-" '{print $$2}') -GO_VERSION=$(shell gobuild -v) -GO := $(or $(GOROOT),/usr/lib/go)/bin/go -PROCS := $(shell nproc) -cores: - @echo "cores: $(PROCS)" -bench: - go test -bench . -bench-record: - $(GO) test -bench . > "benchmarks/stun-go-$(GO_VERSION).txt" -fuzz-prepare-msg: - go-fuzz-build -func FuzzMessage -o stun-msg-fuzz.zip github.com/gortc/stun -fuzz-prepare-typ: - go-fuzz-build -func FuzzType -o stun-typ-fuzz.zip github.com/gortc/stun -fuzz-prepare-setters: - go-fuzz-build -func FuzzSetters -o stun-setters-fuzz.zip github.com/gortc/stun -fuzz-msg: - go-fuzz -bin=./stun-msg-fuzz.zip -workdir=fuzz/stun-msg -fuzz-typ: - go-fuzz -bin=./stun-typ-fuzz.zip -workdir=fuzz/stun-typ -fuzz-setters: - go-fuzz -bin=./stun-setters-fuzz.zip -workdir=fuzz/stun-setters -fuzz-test: - go test -tags gofuzz -run TestFuzz -v . -fuzz-reset-setters: - rm -f -v -r stun-setters-fuzz.zip fuzz/stun-setters -lint: - @echo "linting on $(PROCS) cores" - @gometalinter \ - --enable-all \ - -e "_test.go.+(gocyclo|errcheck|dupl)" \ - -e "attributes\.go.+credentials,.+,LOW.+\(gas\)" \ - -e "Message.+\(aligncheck\)" \ - -e "arg .+ for .+ verb %. of wrong type" \ - -e "error return value not checked \(fmt.Fprint\(h, k\)\) " \ - -e "parameter result 0 \(int\) is never used" \ - -e "cmd\/" \ - -e "e2e\/.+(gocyclo|errcheck|dupl)" \ - -e "internal\/hmac\/hmac_test.+(lll)" \ - -e "internal\/hmac\/.+Errors unhandled" \ - -e "internal\/hmac\/.+parameter blocksize always receives 64" \ - -e "cyclomatic complexity \d+ of function \(\*Client\)\.handleAgentCallback\(\)" \ - --enable="lll" --line-length=100 \ - --disable="gochecknoglobals" \ - --deadline=300s \ - -j $(PROCS) \ - ./... - @gocritic check-project . - @echo "ok" -escape: - @echo "Not escapes, except autogenerated:" - @go build -gcflags '-m -l' 2>&1 \ - | grep -v "" \ - | grep escapes -format: - goimports -w . -bench-compare: - go test -bench . > bench.go-16 - go-tip test -bench . > bench.go-tip - @benchcmp bench.go-16 bench.go-tip -install-fuzz: - go get -u github.com/dvyukov/go-fuzz/go-fuzz-build - go get github.com/dvyukov/go-fuzz/go-fuzz -install: - go get gortc.io/api - go get -u github.com/go-critic/go-critic/... - go get -u github.com/alecthomas/gometalinter - gometalinter --install --update -docker-build: - docker build -t gortc/stun . -test-integration: - @cd e2e && bash ./test.sh -prepush: test lint test-integration -check-api: - @cd api && bash ./check.sh -test: - @./go.test.sh diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/README.md b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/README.md deleted file mode 100644 index 9f2635d..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/README.md +++ /dev/null @@ -1,139 +0,0 @@ -[![Build Status](https://travis-ci.com/gortc/stun.svg)](https://travis-ci.com/gortc/stun) -[![Master status](https://tc.gortc.io/app/rest/builds/buildType:(id:stun_MasterStatus)/statusIcon.svg)](https://tc.gortc.io) -[![Build status](https://ci.appveyor.com/api/projects/status/fw3drn3k52mf5ghw/branch/master?svg=true)](https://ci.appveyor.com/project/ernado/stun-j08g0/branch/master) -[![GoDoc](https://godoc.org/github.com/gortc/stun?status.svg)](http://godoc.org/github.com/gortc/stun) -[![codecov](https://codecov.io/gh/gortc/stun/branch/master/graph/badge.svg)](https://codecov.io/gh/gortc/stun) -[![Go Report](https://goreportcard.com/badge/github.com/gortc/stun?camo=retarded)](http://goreportcard.com/report/gortc/stun) -[![stability-beta](https://img.shields.io/badge/stability-beta-33bbff.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#beta) -![GitHub tag](https://img.shields.io/github/tag/gortc/stun.svg) -# STUN -Package stun implements Session Traversal Utilities for NAT (STUN) [[RFC 5389](https://tools.ietf.org/html/rfc5389)] -with no external dependencies and zero allocations in hot paths. -Complies to [gortc principles](https://gortc.io/#principles) as core package. - -See [example](https://godoc.org/github.com/gortc/stun#example-Message) and [stun server](https://github.com/gortc/stund) for simple usage. -Also see [gortc/turn](https://github.com/gortc/turn) for TURN [[RFC 5766](https://tools.ietf.org/html/rfc5766)] implementation and -[gortcd](https://github.com/gortc/gortcd) for TURN and STUN server. - -# Example -You can get your current IP address from any STUN server by sending -binding request. See more idiomatic example at `cmd/stun-client`. -```go -package main - -import ( - "fmt" - "time" - - "github.com/gortc/stun" -) - -func main() { - // Creating a "connection" to STUN server. - c, err := stun.Dial("udp", "stun.l.google.com:19302") - if err != nil { - panic(err) - } - // Building binding request with random transaction id. - message := stun.MustBuild(stun.TransactionID, stun.BindingRequest) - // Sending request to STUN server, waiting for response message. - if err := c.Do(message, func(res stun.Event) { - if res.Error != nil { - panic(res.Error) - } - // Decoding XOR-MAPPED-ADDRESS attribute from message. - var xorAddr stun.XORMappedAddress - if err := xorAddr.GetFrom(res.Message); err != nil { - panic(err) - } - fmt.Println("your IP is", xorAddr.IP) - }); err != nil { - panic(err) - } -} -``` - -## RFCs - -The package aims to implement the following RFCs. - -rfc | status | description -----|--------|---- -[![RFC5389](https://img.shields.io/badge/RFC-5389-blue.svg)](https://tools.ietf.org/html/rfc5389) | ![status](https://img.shields.io/badge/status-beta-green.svg) | Session Traversal Utilities for NAT -[![RFC7064](https://img.shields.io/badge/RFC-7064-blue.svg)](https://tools.ietf.org/html/rfc7064) | ![status](https://img.shields.io/badge/status-beta-green.svg) | STUN URI -IPv6 | ![status](https://img.shields.io/badge/status-beta-green.svg) | IPv6 support -[(TLS-over-)TCP](https://tools.ietf.org/html/rfc5389#section-7.2.2) | ![status](https://img.shields.io/badge/status-beta-green.svg) | Sending over TCP or TLS-over-TCP -[ALTERNATE-SERVER](https://tools.ietf.org/html/rfc5389#section-11) | ![status](https://img.shields.io/badge/status-dev-blue.svg) | ALTERNATE-SERVER Mechanism - - -# Stability -Package is currently approaching beta stage, API should be fairly stable -(with exception of Agent and Client) and implementation is almost complete. -Bug reports are welcome. - -Additional attributes are unlikely to be implemented in scope of stun package, -the only exception is constants for attribute or message types. - -# RFC 3489 notes -RFC 5389 obsoletes RFC 3489, so implementation was ignored by purpose, however, -RFC 3489 can be easily implemented as separate package. - -# Requirements -Go 1.10 is currently supported and tested in CI. Should work on 1.9 and tip. - -# Benchmarks - -Intel(R) Core(TM) i7-8700K: - -``` -version: 1.16.5 -goos: linux -goarch: amd64 -pkg: github.com/gortc/stun -PASS -benchmark iter time/iter throughput bytes alloc allocs ---------- ---- --------- ---------- ----------- ------ -BenchmarkMappedAddress_AddTo-12 30000000 36.40 ns/op 0 B/op 0 allocs/op -BenchmarkAlternateServer_AddTo-12 50000000 36.70 ns/op 0 B/op 0 allocs/op -BenchmarkAgent_GC-12 500000 2552.00 ns/op 0 B/op 0 allocs/op -BenchmarkAgent_Process-12 50000000 38.00 ns/op 0 B/op 0 allocs/op -BenchmarkMessage_GetNotFound-12 200000000 6.90 ns/op 0 B/op 0 allocs/op -BenchmarkMessage_Get-12 200000000 7.61 ns/op 0 B/op 0 allocs/op -BenchmarkClient_Do-12 2000000 1072.00 ns/op 0 B/op 0 allocs/op -BenchmarkErrorCode_AddTo-12 20000000 67.00 ns/op 0 B/op 0 allocs/op -BenchmarkErrorCodeAttribute_AddTo-12 30000000 52.20 ns/op 0 B/op 0 allocs/op -BenchmarkErrorCodeAttribute_GetFrom-12 100000000 12.00 ns/op 0 B/op 0 allocs/op -BenchmarkFingerprint_AddTo-12 20000000 102.00 ns/op 430.08 MB/s 0 B/op 0 allocs/op -BenchmarkFingerprint_Check-12 30000000 54.80 ns/op 948.38 MB/s 0 B/op 0 allocs/op -BenchmarkBuildOverhead/Build-12 5000000 333.00 ns/op 0 B/op 0 allocs/op -BenchmarkBuildOverhead/BuildNonPointer-12 3000000 536.00 ns/op 100 B/op 4 allocs/op -BenchmarkBuildOverhead/Raw-12 10000000 181.00 ns/op 0 B/op 0 allocs/op -BenchmarkMessageIntegrity_AddTo-12 1000000 1053.00 ns/op 18.98 MB/s 0 B/op 0 allocs/op -BenchmarkMessageIntegrity_Check-12 1000000 1135.00 ns/op 28.17 MB/s 0 B/op 0 allocs/op -BenchmarkMessage_Write-12 100000000 27.70 ns/op 1011.09 MB/s 0 B/op 0 allocs/op -BenchmarkMessageType_Value-12 2000000000 0.49 ns/op 0 B/op 0 allocs/op -BenchmarkMessage_WriteTo-12 100000000 12.80 ns/op 0 B/op 0 allocs/op -BenchmarkMessage_ReadFrom-12 50000000 25.00 ns/op 801.19 MB/s 0 B/op 0 allocs/op -BenchmarkMessage_ReadBytes-12 100000000 18.00 ns/op 1113.03 MB/s 0 B/op 0 allocs/op -BenchmarkIsMessage-12 2000000000 1.08 ns/op 18535.57 MB/s 0 B/op 0 allocs/op -BenchmarkMessage_NewTransactionID-12 2000000 673.00 ns/op 0 B/op 0 allocs/op -BenchmarkMessageFull-12 5000000 316.00 ns/op 0 B/op 0 allocs/op -BenchmarkMessageFullHardcore-12 20000000 88.90 ns/op 0 B/op 0 allocs/op -BenchmarkMessage_WriteHeader-12 200000000 8.18 ns/op 0 B/op 0 allocs/op -BenchmarkMessage_CloneTo-12 30000000 37.90 ns/op 1795.32 MB/s 0 B/op 0 allocs/op -BenchmarkMessage_AddTo-12 300000000 4.77 ns/op 0 B/op 0 allocs/op -BenchmarkDecode-12 100000000 22.00 ns/op 0 B/op 0 allocs/op -BenchmarkUsername_AddTo-12 50000000 23.20 ns/op 0 B/op 0 allocs/op -BenchmarkUsername_GetFrom-12 100000000 17.90 ns/op 0 B/op 0 allocs/op -BenchmarkNonce_AddTo-12 50000000 34.40 ns/op 0 B/op 0 allocs/op -BenchmarkNonce_AddTo_BadLength-12 200000000 8.29 ns/op 0 B/op 0 allocs/op -BenchmarkNonce_GetFrom-12 100000000 17.50 ns/op 0 B/op 0 allocs/op -BenchmarkUnknownAttributes/AddTo-12 30000000 48.10 ns/op 0 B/op 0 allocs/op -BenchmarkUnknownAttributes/GetFrom-12 100000000 20.90 ns/op 0 B/op 0 allocs/op -BenchmarkXOR-12 50000000 25.80 ns/op 39652.86 MB/s 0 B/op 0 allocs/op -BenchmarkXORSafe-12 3000000 515.00 ns/op 1988.04 MB/s 0 B/op 0 allocs/op -BenchmarkXORFast-12 20000000 73.40 ns/op 13959.30 MB/s 0 B/op 0 allocs/op -BenchmarkXORMappedAddress_AddTo-12 20000000 56.70 ns/op 0 B/op 0 allocs/op -BenchmarkXORMappedAddress_GetFrom-12 50000000 37.40 ns/op 0 B/op 0 allocs/op -ok github.com/gortc/stun 76.868s -``` diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/addr.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/addr.go deleted file mode 100644 index 8cf37e5..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/addr.go +++ /dev/null @@ -1,110 +0,0 @@ -package stun - -import ( - "fmt" - "io" - "net" - "strconv" -) - -// MappedAddress represents MAPPED-ADDRESS attribute. -// -// This attribute is used only by servers for achieving backwards -// compatibility with RFC 3489 clients. -// -// RFC 5389 Section 15.1 -type MappedAddress struct { - IP net.IP - Port int -} - -// AlternateServer represents ALTERNATE-SERVER attribute. -// -// RFC 5389 Section 15.11 -type AlternateServer struct { - IP net.IP - Port int -} - -// AddTo adds ALTERNATE-SERVER attribute to message. -func (s *AlternateServer) AddTo(m *Message) error { - a := (*MappedAddress)(s) - return a.addAs(m, AttrAlternateServer) -} - -// GetFrom decodes ALTERNATE-SERVER from message. -func (s *AlternateServer) GetFrom(m *Message) error { - a := (*MappedAddress)(s) - return a.getAs(m, AttrAlternateServer) -} - -func (a MappedAddress) String() string { - return net.JoinHostPort(a.IP.String(), strconv.Itoa(a.Port)) -} - -func (a *MappedAddress) getAs(m *Message, t AttrType) error { - v, err := m.Get(t) - if err != nil { - return err - } - if len(v) <= 4 { - return io.ErrUnexpectedEOF - } - family := bin.Uint16(v[0:2]) - if family != familyIPv6 && family != familyIPv4 { - return newDecodeErr("xor-mapped address", "family", - fmt.Sprintf("bad value %d", family), - ) - } - ipLen := net.IPv4len - if family == familyIPv6 { - ipLen = net.IPv6len - } - // Ensuring len(a.IP) == ipLen and reusing a.IP. - if len(a.IP) < ipLen { - a.IP = a.IP[:cap(a.IP)] - for len(a.IP) < ipLen { - a.IP = append(a.IP, 0) - } - } - a.IP = a.IP[:ipLen] - for i := range a.IP { - a.IP[i] = 0 - } - a.Port = int(bin.Uint16(v[2:4])) - copy(a.IP, v[4:]) - return nil -} - -func (a *MappedAddress) addAs(m *Message, t AttrType) error { - var ( - family = familyIPv4 - ip = a.IP - ) - if len(a.IP) == net.IPv6len { - if isIPv4(ip) { - ip = ip[12:16] // like in ip.To4() - } else { - family = familyIPv6 - } - } else if len(ip) != net.IPv4len { - return ErrBadIPLength - } - value := make([]byte, 128) - value[0] = 0 // first 8 bits are zeroes - bin.PutUint16(value[0:2], family) - bin.PutUint16(value[2:4], uint16(a.Port)) - copy(value[4:], ip) - m.Add(t, value[:4+len(ip)]) - return nil -} - -// AddTo adds MAPPED-ADDRESS to message. -func (a *MappedAddress) AddTo(m *Message) error { - return a.addAs(m, AttrMappedAddress) -} - -// GetFrom decodes MAPPED-ADDRESS from message. -func (a *MappedAddress) GetFrom(m *Message) error { - return a.getAs(m, AttrMappedAddress) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/agent.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/agent.go deleted file mode 100644 index 6a8a473..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/agent.go +++ /dev/null @@ -1,228 +0,0 @@ -package stun - -import ( - "errors" - "sync" - "time" -) - -// NoopHandler just discards any event. -var NoopHandler Handler = func(e Event) {} - -// NewAgent initializes and returns new Agent with provided handler. -// If h is nil, the NoopHandler will be used. -func NewAgent(h Handler) *Agent { - if h == nil { - h = NoopHandler - } - a := &Agent{ - transactions: make(map[transactionID]agentTransaction), - handler: h, - } - return a -} - -// Agent is low-level abstraction over transaction list that -// handles concurrency (all calls are goroutine-safe) and -// time outs (via Collect call). -type Agent struct { - // transactions is map of transactions that are currently - // in progress. Event handling is done in such way when - // transaction is unregistered before agentTransaction access, - // minimizing mux lock and protecting agentTransaction from - // data races via unexpected concurrent access. - transactions map[transactionID]agentTransaction - closed bool // all calls are invalid if true - mux sync.Mutex // protects transactions and closed - handler Handler // handles transactions -} - -// Handler handles state changes of transaction. -// -// Handler is called on transaction state change. -// Usage of e is valid only during call, user must -// copy needed fields explicitly. -type Handler func(e Event) - -// Event is passed to Handler describing the transaction event. -// Do not reuse outside Handler. -type Event struct { - TransactionID [TransactionIDSize]byte - Message *Message - Error error -} - -// agentTransaction represents transaction in progress. -// Concurrent access is invalid. -type agentTransaction struct { - id transactionID - deadline time.Time -} - -var ( - // ErrTransactionStopped indicates that transaction was manually stopped. - ErrTransactionStopped = errors.New("transaction is stopped") - // ErrTransactionNotExists indicates that agent failed to find transaction. - ErrTransactionNotExists = errors.New("transaction not exists") - // ErrTransactionExists indicates that transaction with same id is already - // registered. - ErrTransactionExists = errors.New("transaction exists with same id") -) - -// StopWithError removes transaction from list and calls handler with -// provided error. Can return ErrTransactionNotExists and ErrAgentClosed. -func (a *Agent) StopWithError(id [TransactionIDSize]byte, err error) error { - a.mux.Lock() - if a.closed { - a.mux.Unlock() - return ErrAgentClosed - } - t, exists := a.transactions[id] - delete(a.transactions, id) - h := a.handler - a.mux.Unlock() - if !exists { - return ErrTransactionNotExists - } - h(Event{ - TransactionID: t.id, - Error: err, - }) - return nil -} - -// Stop stops transaction by id with ErrTransactionStopped, blocking -// until handler returns. -func (a *Agent) Stop(id [TransactionIDSize]byte) error { - return a.StopWithError(id, ErrTransactionStopped) -} - -// ErrAgentClosed indicates that agent is in closed state and is unable -// to handle transactions. -var ErrAgentClosed = errors.New("agent is closed") - -// Start registers transaction with provided id and deadline. -// Could return ErrAgentClosed, ErrTransactionExists. -// -// Agent handler is guaranteed to be eventually called. -func (a *Agent) Start(id [TransactionIDSize]byte, deadline time.Time) error { - a.mux.Lock() - defer a.mux.Unlock() - if a.closed { - return ErrAgentClosed - } - _, exists := a.transactions[id] - if exists { - return ErrTransactionExists - } - a.transactions[id] = agentTransaction{ - id: id, - deadline: deadline, - } - return nil -} - -// agentCollectCap is initial capacity for Agent.Collect slices, -// sufficient to make function zero-alloc in most cases. -const agentCollectCap = 100 - -// ErrTransactionTimeOut indicates that transaction has reached deadline. -var ErrTransactionTimeOut = errors.New("transaction is timed out") - -// Collect terminates all transactions that have deadline before provided -// time, blocking until all handlers will process ErrTransactionTimeOut. -// Will return ErrAgentClosed if agent is already closed. -// -// It is safe to call Collect concurrently but makes no sense. -func (a *Agent) Collect(gcTime time.Time) error { - toRemove := make([]transactionID, 0, agentCollectCap) - a.mux.Lock() - if a.closed { - // Doing nothing if agent is closed. - // All transactions should be already closed - // during Close() call. - a.mux.Unlock() - return ErrAgentClosed - } - // Adding all transactions with deadline before gcTime - // to toCall and toRemove slices. - // No allocs if there are less than agentCollectCap - // timed out transactions. - for id, t := range a.transactions { - if t.deadline.Before(gcTime) { - toRemove = append(toRemove, id) - } - } - // Un-registering timed out transactions. - for _, id := range toRemove { - delete(a.transactions, id) - } - // Calling handler does not require locked mutex, - // reducing lock time. - h := a.handler - a.mux.Unlock() - // Sending ErrTransactionTimeOut to handler for all transactions, - // blocking until last one. - event := Event{ - Error: ErrTransactionTimeOut, - } - for _, id := range toRemove { - event.TransactionID = id - h(event) - } - return nil -} - -// Process incoming message, synchronously passing it to handler. -func (a *Agent) Process(m *Message) error { - e := Event{ - TransactionID: m.TransactionID, - Message: m, - } - a.mux.Lock() - if a.closed { - a.mux.Unlock() - return ErrAgentClosed - } - h := a.handler - delete(a.transactions, m.TransactionID) - a.mux.Unlock() - h(e) - return nil -} - -// SetHandler sets agent handler to h. -func (a *Agent) SetHandler(h Handler) error { - a.mux.Lock() - if a.closed { - a.mux.Unlock() - return ErrAgentClosed - } - a.handler = h - a.mux.Unlock() - return nil -} - -// Close terminates all transactions with ErrAgentClosed and renders Agent to -// closed state. -func (a *Agent) Close() error { - e := Event{ - Error: ErrAgentClosed, - } - a.mux.Lock() - if a.closed { - a.mux.Unlock() - return ErrAgentClosed - } - for _, t := range a.transactions { - e.TransactionID = t.id - a.handler(e) - } - a.transactions = nil - a.closed = true - a.handler = nil - a.mux.Unlock() - return nil -} - -type transactionID [TransactionIDSize]byte diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/appveyor.yml b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/appveyor.yml deleted file mode 100644 index f00c04d..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/appveyor.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: "{build}" - -platform: x64 - -branches: - only: - - master - -skip_tags: true - -clone_folder: c:\gopath\src\github.com\gortc\stun - -environment: - GOPATH: c:\gopath - GOVERSION: 1.10 - -install: - - go version - - go get -v -t . - -build_script: - - go test -v . diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/attributes.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/attributes.go deleted file mode 100644 index 95799b4..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/attributes.go +++ /dev/null @@ -1,195 +0,0 @@ -package stun - -import ( - "errors" - "fmt" -) - -// Attributes is list of message attributes. -type Attributes []RawAttribute - -// Get returns first attribute from list by the type. -// If attribute is present the RawAttribute is returned and the -// boolean is true. Otherwise the returned RawAttribute will be -// empty and boolean will be false. -func (a Attributes) Get(t AttrType) (RawAttribute, bool) { - for _, candidate := range a { - if candidate.Type == t { - return candidate, true - } - } - return RawAttribute{}, false -} - -// AttrType is attribute type. -type AttrType uint16 - -// Required returns true if type is from comprehension-required range (0x0000-0x7FFF). -func (t AttrType) Required() bool { - return t <= 0x7FFF -} - -// Optional returns true if type is from comprehension-optional range (0x8000-0xFFFF). -func (t AttrType) Optional() bool { - return t >= 0x8000 -} - -// Attributes from comprehension-required range (0x0000-0x7FFF). -const ( - AttrMappedAddress AttrType = 0x0001 // MAPPED-ADDRESS - AttrUsername AttrType = 0x0006 // USERNAME - AttrMessageIntegrity AttrType = 0x0008 // MESSAGE-INTEGRITY - AttrErrorCode AttrType = 0x0009 // ERROR-CODE - AttrUnknownAttributes AttrType = 0x000A // UNKNOWN-ATTRIBUTES - AttrRealm AttrType = 0x0014 // REALM - AttrNonce AttrType = 0x0015 // NONCE - AttrXORMappedAddress AttrType = 0x0020 // XOR-MAPPED-ADDRESS -) - -// Attributes from comprehension-optional range (0x8000-0xFFFF). -const ( - AttrSoftware AttrType = 0x8022 // SOFTWARE - AttrAlternateServer AttrType = 0x8023 // ALTERNATE-SERVER - AttrFingerprint AttrType = 0x8028 // FINGERPRINT -) - -// Attributes from RFC 5245 ICE. -const ( - AttrPriority AttrType = 0x0024 // PRIORITY - AttrUseCandidate AttrType = 0x0025 // USE-CANDIDATE - AttrICEControlled AttrType = 0x8029 // ICE-CONTROLLED - AttrICEControlling AttrType = 0x802A // ICE-CONTROLLING -) - -// Attributes from RFC 5766 TURN. -const ( - AttrChannelNumber AttrType = 0x000C // CHANNEL-NUMBER - AttrLifetime AttrType = 0x000D // LIFETIME - AttrXORPeerAddress AttrType = 0x0012 // XOR-PEER-ADDRESS - AttrData AttrType = 0x0013 // DATA - AttrXORRelayedAddress AttrType = 0x0016 // XOR-RELAYED-ADDRESS - AttrEvenPort AttrType = 0x0018 // EVEN-PORT - AttrRequestedTransport AttrType = 0x0019 // REQUESTED-TRANSPORT - AttrDontFragment AttrType = 0x001A // DONT-FRAGMENT - AttrReservationToken AttrType = 0x0022 // RESERVATION-TOKEN -) - -// Attributes from RFC 6156 TURN IPv6. -const ( - AttrRequestedAddressFamily AttrType = 0x0017 // REQUESTED-ADDRESS-FAMILY -) - -// Attributes from An Origin Attribute for the STUN Protocol. -const ( - AttrOrigin AttrType = 0x802F -) - -// Value returns uint16 representation of attribute type. -func (t AttrType) Value() uint16 { - return uint16(t) -} - -var attrNames = map[AttrType]string{ - AttrMappedAddress: "MAPPED-ADDRESS", - AttrUsername: "USERNAME", - AttrErrorCode: "ERROR-CODE", - AttrMessageIntegrity: "MESSAGE-INTEGRITY", - AttrUnknownAttributes: "UNKNOWN-ATTRIBUTES", - AttrRealm: "REALM", - AttrNonce: "NONCE", - AttrXORMappedAddress: "XOR-MAPPED-ADDRESS", - AttrSoftware: "SOFTWARE", - AttrAlternateServer: "ALTERNATE-SERVER", - AttrFingerprint: "FINGERPRINT", - AttrPriority: "PRIORITY", - AttrUseCandidate: "USE-CANDIDATE", - AttrICEControlled: "ICE-CONTROLLED", - AttrICEControlling: "ICE-CONTROLLING", - AttrChannelNumber: "CHANNEL-NUMBER", - AttrLifetime: "LIFETIME", - AttrXORPeerAddress: "XOR-PEER-ADDRESS", - AttrData: "DATA", - AttrXORRelayedAddress: "XOR-RELAYED-ADDRESS", - AttrEvenPort: "EVEN-PORT", - AttrRequestedTransport: "REQUESTED-TRANSPORT", - AttrDontFragment: "DONT-FRAGMENT", - AttrReservationToken: "RESERVATION-TOKEN", - AttrRequestedAddressFamily: "REQUESTED-ADDRESS-FAMILY", - AttrOrigin: "ORIGIN", -} - -func (t AttrType) String() string { - s, ok := attrNames[t] - if !ok { - // Just return hex representation of unknown attribute type. - return fmt.Sprintf("0x%x", uint16(t)) - } - return s -} - -// RawAttribute is a Type-Length-Value (TLV) object that -// can be added to a STUN message. Attributes are divided into two -// types: comprehension-required and comprehension-optional. STUN -// agents can safely ignore comprehension-optional attributes they -// don't understand, but cannot successfully process a message if it -// contains comprehension-required attributes that are not -// understood. -type RawAttribute struct { - Type AttrType - Length uint16 // ignored while encoding - Value []byte -} - -// Equal returns true if a == b. -func (a RawAttribute) Equal(b RawAttribute) bool { - if a.Type != b.Type { - return false - } - if a.Length != b.Length { - return false - } - if len(b.Value) != len(a.Value) { - return false - } - for i, v := range a.Value { - if b.Value[i] != v { - return false - } - } - return true -} - -func (a RawAttribute) String() string { - return fmt.Sprintf("%s: 0x%x", a.Type, a.Value) -} - -// ErrAttributeNotFound means that attribute with provided attribute -// type does not exist in message. -var ErrAttributeNotFound = errors.New("attribute not found") - -// Get returns byte slice that represents attribute value, -// if there is no attribute with such type, -// ErrAttributeNotFound is returned. -func (m *Message) Get(t AttrType) ([]byte, error) { - v, ok := m.Attributes.Get(t) - if !ok { - return nil, ErrAttributeNotFound - } - return v.Value, nil -} - -// STUN aligns attributes on 32-bit boundaries, attributes whose content -// is not a multiple of 4 bytes are padded with 1, 2, or 3 bytes of -// padding so that its value contains a multiple of 4 bytes. The -// padding bits are ignored, and may be any value. -// -// https://tools.ietf.org/html/rfc5389#section-15 -const padding = 4 - -func nearestPaddedValueLength(l int) int { - n := padding * (l / padding) - if n < l { - n += padding - } - return n -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/attributes_debug.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/attributes_debug.go deleted file mode 100644 index 7bf09af..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/attributes_debug.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build debug - -package stun - -import "fmt" - -// AttrOverflowErr occurs when len(v) > Max. -type AttrOverflowErr struct { - Type AttrType - Max int - Got int -} - -func (e AttrOverflowErr) Error() string { - return fmt.Sprintf("incorrect length of %s attribute: %d exceeds maximum %d", - e.Type, e.Got, e.Max, - ) -} - -// AttrLengthErr means that length for attribute is invalid. -type AttrLengthErr struct { - Attr AttrType - Got int - Expected int -} - -func (e AttrLengthErr) Error() string { - return fmt.Sprintf("incorrect length of %s attribute: got %d, expected %d", - e.Attr, - e.Got, - e.Expected, - ) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/checks.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/checks.go deleted file mode 100644 index ca58525..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/checks.go +++ /dev/null @@ -1,45 +0,0 @@ -// +build !debug - -package stun - -import "github.com/gortc/stun/internal/hmac" - -// CheckSize returns ErrAttrSizeInvalid if got is not equal to expected. -func CheckSize(_ AttrType, got, expected int) error { - if got == expected { - return nil - } - return ErrAttributeSizeInvalid -} - -func checkHMAC(got, expected []byte) error { - if hmac.Equal(got, expected) { - return nil - } - return ErrIntegrityMismatch -} - -func checkFingerprint(got, expected uint32) error { - if got == expected { - return nil - } - return ErrFingerprintMismatch -} - -// IsAttrSizeInvalid returns true if error means that attribute size is invalid. -func IsAttrSizeInvalid(err error) bool { - return err == ErrAttributeSizeInvalid -} - -// CheckOverflow returns ErrAttributeSizeOverflow if got is bigger that max. -func CheckOverflow(_ AttrType, got, max int) error { - if got <= max { - return nil - } - return ErrAttributeSizeOverflow -} - -// IsAttrSizeOverflow returns true if error means that attribute size is too big. -func IsAttrSizeOverflow(err error) bool { - return err == ErrAttributeSizeOverflow -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/checks_debug.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/checks_debug.go deleted file mode 100644 index 1b0b9c3..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/checks_debug.go +++ /dev/null @@ -1,61 +0,0 @@ -// +build debug - -package stun - -import "github.com/gortc/stun/internal/hmac" - -// CheckSize returns *AttrLengthError if got is not equal to expected. -func CheckSize(a AttrType, got, expected int) error { - if got == expected { - return nil - } - return &AttrLengthErr{ - Got: got, - Expected: expected, - Attr: a, - } -} - -func checkHMAC(got, expected []byte) error { - if hmac.Equal(got, expected) { - return nil - } - return &IntegrityErr{ - Expected: expected, - Actual: got, - } -} - -func checkFingerprint(got, expected uint32) error { - if got == expected { - return nil - } - return &CRCMismatch{ - Actual: got, - Expected: expected, - } -} - -// IsAttrSizeInvalid returns true if error means that attribute size is invalid. -func IsAttrSizeInvalid(err error) bool { - _, ok := err.(*AttrLengthErr) - return ok -} - -// CheckOverflow returns *AttrOverflowErr if got is bigger that max. -func CheckOverflow(t AttrType, got, max int) error { - if got <= max { - return nil - } - return &AttrOverflowErr{ - Type: t, - Got: got, - Max: max, - } -} - -// IsAttrSizeOverflow returns true if error means that attribute size is too big. -func IsAttrSizeOverflow(err error) bool { - _, ok := err.(*AttrOverflowErr) - return ok -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/client.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/client.go deleted file mode 100644 index 5eb246b..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/client.go +++ /dev/null @@ -1,616 +0,0 @@ -package stun - -import ( - "errors" - "fmt" - "io" - "log" - "net" - "runtime" - "sync" - "sync/atomic" - "time" -) - -// Dial connects to the address on the named network and then -// initializes Client on that connection, returning error if any. -func Dial(network, address string) (*Client, error) { - conn, err := net.Dial(network, address) - if err != nil { - return nil, err - } - return NewClient(conn) -} - -// ErrNoConnection means that ClientOptions.Connection is nil. -var ErrNoConnection = errors.New("no connection provided") - -// ClientOption sets some client option. -type ClientOption func(c *Client) - -// WithHandler sets client handler which is called if Agent emits the Event -// with TransactionID that is not currently registered by Client. -// Useful for handling Data indications from TURN server. -func WithHandler(h Handler) ClientOption { - return func(c *Client) { - c.handler = h - } -} - -// WithRTO sets client RTO as defined in STUN RFC. -func WithRTO(rto time.Duration) ClientOption { - return func(c *Client) { - c.rto = int64(rto) - } -} - -// WithClock sets Clock of client, the source of current time. -// Also clock is passed to default collector if set. -func WithClock(clock Clock) ClientOption { - return func(c *Client) { - c.clock = clock - } -} - -// WithTimeoutRate sets RTO timer minimum resolution. -func WithTimeoutRate(d time.Duration) ClientOption { - return func(c *Client) { - c.rtoRate = d - } -} - -// WithAgent sets client STUN agent. -// -// Defaults to agent implementation in current package, -// see agent.go. -func WithAgent(a ClientAgent) ClientOption { - return func(c *Client) { - c.a = a - } -} - -// WithCollector rests client timeout collector, the implementation -// of ticker which calls function on each tick. -func WithCollector(coll Collector) ClientOption { - return func(c *Client) { - c.collector = coll - } -} - -// WithNoRetransmit disables retransmissions and sets RTO to -// defaultMaxAttempts * defaultRTO which will be effectively time out -// if not set. -// -// Useful for TCP connections where transport handles RTO. -func WithNoRetransmit(c *Client) { - c.maxAttempts = 0 - if c.rto == 0 { - c.rto = defaultMaxAttempts * int64(defaultRTO) - } -} - -const ( - defaultTimeoutRate = time.Millisecond * 5 - defaultRTO = time.Millisecond * 300 - defaultMaxAttempts = 7 -) - -// NewClient initializes new Client from provided options, -// starting internal goroutines and using default options fields -// if necessary. Call Close method after using Client to release -// resources. -func NewClient(conn Connection, options ...ClientOption) (*Client, error) { - c := &Client{ - close: make(chan struct{}), - c: conn, - clock: systemClock, - rto: int64(defaultRTO), - rtoRate: defaultTimeoutRate, - t: make(map[transactionID]*clientTransaction, 100), - maxAttempts: defaultMaxAttempts, - } - for _, o := range options { - o(c) - } - if c.c == nil { - return nil, ErrNoConnection - } - if c.a == nil { - c.a = NewAgent(nil) - } - if err := c.a.SetHandler(c.handleAgentCallback); err != nil { - return nil, err - } - if c.collector == nil { - c.collector = &tickerCollector{ - close: make(chan struct{}), - clock: c.clock, - } - } - if err := c.collector.Start(c.rtoRate, func(t time.Time) { - closedOrPanic(c.a.Collect(t)) - }); err != nil { - return nil, err - } - c.wg.Add(1) - go c.readUntilClosed() - runtime.SetFinalizer(c, clientFinalizer) - return c, nil -} - -func clientFinalizer(c *Client) { - if c == nil { - return - } - err := c.Close() - if err == ErrClientClosed { - return - } - if err == nil { - log.Println("client: called finalizer on non-closed client") - return - } - log.Println("client: called finalizer on non-closed client:", err) -} - -// Connection wraps Reader, Writer and Closer interfaces. -type Connection interface { - io.Reader - io.Writer - io.Closer -} - -// ClientAgent is Agent implementation that is used by Client to -// process transactions. -type ClientAgent interface { - Process(*Message) error - Close() error - Start(id [TransactionIDSize]byte, deadline time.Time) error - Stop(id [TransactionIDSize]byte) error - Collect(time.Time) error - SetHandler(h Handler) error -} - -// Client simulates "connection" to STUN server. -type Client struct { - a ClientAgent - c Connection - close chan struct{} - rto int64 // time.Duration - rtoRate time.Duration - maxAttempts int32 - closed bool - wg sync.WaitGroup - clock Clock - handler Handler - collector Collector - t map[transactionID]*clientTransaction - - // mux guards closed and t - mux sync.RWMutex -} - -// clientTransaction represents transaction in progress. -// If transaction is succeed or failed, f will be called -// provided by event. -// Concurrent access is invalid. -type clientTransaction struct { - id transactionID - attempt int32 - calls int32 - h Handler - start time.Time - rto time.Duration - raw []byte -} - -func (t *clientTransaction) handle(e Event) { - if atomic.AddInt32(&t.calls, 1) == 1 { - t.h(e) - } -} - -var clientTransactionPool = &sync.Pool{ - New: func() interface{} { - return &clientTransaction{ - raw: make([]byte, 1500), - } - }, -} - -func acquireClientTransaction() *clientTransaction { - return clientTransactionPool.Get().(*clientTransaction) -} - -func putClientTransaction(t *clientTransaction) { - t.raw = t.raw[:0] - t.start = time.Time{} - t.attempt = 0 - t.id = transactionID{} - clientTransactionPool.Put(t) -} - -func (t clientTransaction) nextTimeout(now time.Time) time.Time { - return now.Add(time.Duration(t.attempt+1) * t.rto) -} - -// start registers transaction. -// -// Could return ErrClientClosed, ErrTransactionExists. -func (c *Client) start(t *clientTransaction) error { - c.mux.Lock() - defer c.mux.Unlock() - if c.closed { - return ErrClientClosed - } - _, exists := c.t[t.id] - if exists { - return ErrTransactionExists - } - c.t[t.id] = t - return nil -} - -// Clock abstracts the source of current time. -type Clock interface { - Now() time.Time -} - -type systemClockService struct{} - -func (systemClockService) Now() time.Time { return time.Now() } - -var systemClock = systemClockService{} - -// SetRTO sets current RTO value. -func (c *Client) SetRTO(rto time.Duration) { - atomic.StoreInt64(&c.rto, int64(rto)) -} - -// StopErr occurs when Client fails to stop transaction while -// processing error. -type StopErr struct { - Err error // value returned by Stop() - Cause error // error that caused Stop() call -} - -func (e StopErr) Error() string { - return fmt.Sprintf("error while stopping due to %s: %s", - sprintErr(e.Cause), sprintErr(e.Err), - ) -} - -// CloseErr indicates client close failure. -type CloseErr struct { - AgentErr error - ConnectionErr error -} - -func sprintErr(err error) string { - if err == nil { - return "" - } - return err.Error() -} - -func (c CloseErr) Error() string { - return fmt.Sprintf("failed to close: %s (connection), %s (agent)", - sprintErr(c.ConnectionErr), sprintErr(c.AgentErr), - ) -} - -func (c *Client) readUntilClosed() { - defer c.wg.Done() - m := new(Message) - m.Raw = make([]byte, 1024) - for { - select { - case <-c.close: - return - default: - } - _, err := m.ReadFrom(c.c) - if err == nil { - if pErr := c.a.Process(m); pErr == ErrAgentClosed { - return - } - } - } -} - -func closedOrPanic(err error) { - if err == nil || err == ErrAgentClosed { - return - } - panic(err) -} - -type tickerCollector struct { - close chan struct{} - wg sync.WaitGroup - clock Clock -} - -// Collector calls function f with constant rate. -// -// The simple Collector is ticker which calls function on each tick. -type Collector interface { - Start(rate time.Duration, f func(now time.Time)) error - Close() error -} - -func (a *tickerCollector) Start(rate time.Duration, f func(now time.Time)) error { - t := time.NewTicker(rate) - a.wg.Add(1) - go func() { - defer a.wg.Done() - for { - select { - case <-a.close: - t.Stop() - return - case <-t.C: - f(a.clock.Now()) - } - } - }() - return nil -} - -func (a *tickerCollector) Close() error { - close(a.close) - a.wg.Wait() - return nil -} - -// ErrClientClosed indicates that client is closed. -var ErrClientClosed = errors.New("client is closed") - -// Close stops internal connection and agent, returning CloseErr on error. -func (c *Client) Close() error { - if err := c.checkInit(); err != nil { - return err - } - c.mux.Lock() - if c.closed { - c.mux.Unlock() - return ErrClientClosed - } - c.closed = true - c.mux.Unlock() - if closeErr := c.collector.Close(); closeErr != nil { - return closeErr - } - agentErr, connErr := c.a.Close(), c.c.Close() - close(c.close) - c.wg.Wait() - if agentErr == nil && connErr == nil { - return nil - } - return CloseErr{ - AgentErr: agentErr, - ConnectionErr: connErr, - } -} - -// Indicate sends indication m to server. Shorthand to Start call -// with zero deadline and callback. -func (c *Client) Indicate(m *Message) error { - return c.Start(m, nil) -} - -// callbackWaitHandler blocks on wait() call until callback is called. -type callbackWaitHandler struct { - handler Handler - callback func(event Event) - cond *sync.Cond - processed bool -} - -func (s *callbackWaitHandler) HandleEvent(e Event) { - s.cond.L.Lock() - if s.callback == nil { - panic("s.callback is nil") - } - s.callback(e) - s.processed = true - s.cond.Broadcast() - s.cond.L.Unlock() -} - -func (s *callbackWaitHandler) wait() { - s.cond.L.Lock() - for !s.processed { - s.cond.Wait() - } - s.processed = false - s.callback = nil - s.cond.L.Unlock() -} - -func (s *callbackWaitHandler) setCallback(f func(event Event)) { - if f == nil { - panic("f is nil") - } - s.cond.L.Lock() - s.callback = f - if s.handler == nil { - s.handler = s.HandleEvent - } - s.cond.L.Unlock() -} - -var callbackWaitHandlerPool = sync.Pool{ - New: func() interface{} { - return &callbackWaitHandler{ - cond: sync.NewCond(new(sync.Mutex)), - } - }, -} - -// ErrClientNotInitialized means that client connection or agent is nil. -var ErrClientNotInitialized = errors.New("client not initialized") - -func (c *Client) checkInit() error { - if c == nil || c.c == nil || c.a == nil || c.close == nil { - return ErrClientNotInitialized - } - return nil -} - -// Do is Start wrapper that waits until callback is called. If no callback -// provided, Indicate is called instead. -// -// Do has cpu overhead due to blocking, see BenchmarkClient_Do. -// Use Start method for less overhead. -func (c *Client) Do(m *Message, f func(Event)) error { - if err := c.checkInit(); err != nil { - return err - } - if f == nil { - return c.Indicate(m) - } - h := callbackWaitHandlerPool.Get().(*callbackWaitHandler) - h.setCallback(f) - defer func() { - callbackWaitHandlerPool.Put(h) - }() - if err := c.Start(m, h.handler); err != nil { - return err - } - h.wait() - return nil -} - -func (c *Client) delete(id transactionID) { - c.mux.Lock() - if c.t != nil { - delete(c.t, id) - } - c.mux.Unlock() -} - -type buffer struct { - buf []byte -} - -var bufferPool = &sync.Pool{ - New: func() interface{} { - return &buffer{buf: make([]byte, 2048)} - }, -} - -func (c *Client) handleAgentCallback(e Event) { - c.mux.Lock() - if c.closed { - c.mux.Unlock() - return - } - t, found := c.t[e.TransactionID] - if found { - delete(c.t, t.id) - } - c.mux.Unlock() - if !found { - if c.handler != nil && e.Error != ErrTransactionStopped { - c.handler(e) - } - // Ignoring. - return - } - if atomic.LoadInt32(&c.maxAttempts) <= t.attempt || e.Error == nil { - // Transaction completed. - t.handle(e) - putClientTransaction(t) - return - } - // Doing re-transmission. - t.attempt++ - b := bufferPool.Get().(*buffer) - b.buf = b.buf[:copy(b.buf[:cap(b.buf)], t.raw)] - defer bufferPool.Put(b) - var ( - now = c.clock.Now() - timeOut = t.nextTimeout(now) - id = t.id - ) - // Starting client transaction. - if startErr := c.start(t); startErr != nil { - c.delete(id) - e.Error = startErr - t.handle(e) - putClientTransaction(t) - return - } - // Starting agent transaction. - if startErr := c.a.Start(id, timeOut); startErr != nil { - c.delete(id) - e.Error = startErr - t.handle(e) - putClientTransaction(t) - return - } - // Writing message to connection again. - _, writeErr := c.c.Write(b.buf) - if writeErr != nil { - c.delete(id) - e.Error = writeErr - // Stopping agent transaction instead of waiting until it's deadline. - // This will call handleAgentCallback with "ErrTransactionStopped" error - // which will be ignored. - if stopErr := c.a.Stop(id); stopErr != nil { - // Failed to stop agent transaction. Wrapping the error in StopError. - e.Error = StopErr{ - Err: stopErr, - Cause: writeErr, - } - } - t.handle(e) - putClientTransaction(t) - return - } -} - -// Start starts transaction (if f set) and writes message to server, handler -// is called asynchronously. -func (c *Client) Start(m *Message, h Handler) error { - if err := c.checkInit(); err != nil { - return err - } - c.mux.RLock() - closed := c.closed - c.mux.RUnlock() - if closed { - return ErrClientClosed - } - if h != nil { - // Starting transaction only if h is set. Useful for indications. - t := acquireClientTransaction() - t.id = m.TransactionID - t.start = c.clock.Now() - t.h = h - t.rto = time.Duration(atomic.LoadInt64(&c.rto)) - t.attempt = 0 - t.raw = append(t.raw[:0], m.Raw...) - t.calls = 0 - d := t.nextTimeout(t.start) - if err := c.start(t); err != nil { - return err - } - if err := c.a.Start(m.TransactionID, d); err != nil { - return err - } - } - _, err := m.WriteTo(c.c) - if err != nil && h != nil { - c.delete(m.TransactionID) - // Stopping transaction instead of waiting until deadline. - if stopErr := c.a.Stop(m.TransactionID); stopErr != nil { - return StopErr{ - Err: stopErr, - Cause: err, - } - } - } - return err -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/errorcode.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/errorcode.go deleted file mode 100644 index f6abaee..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/errorcode.go +++ /dev/null @@ -1,140 +0,0 @@ -package stun - -import ( - "errors" - "fmt" - "io" -) - -// ErrorCodeAttribute represents ERROR-CODE attribute. -// -// RFC 5389 Section 15.6 -type ErrorCodeAttribute struct { - Code ErrorCode - Reason []byte -} - -func (c ErrorCodeAttribute) String() string { - return fmt.Sprintf("%d: %s", c.Code, c.Reason) -} - -// constants for ERROR-CODE encoding. -const ( - errorCodeReasonStart = 4 - errorCodeClassByte = 2 - errorCodeNumberByte = 3 - errorCodeReasonMaxB = 763 - errorCodeModulo = 100 -) - -// AddTo adds ERROR-CODE to m. -func (c ErrorCodeAttribute) AddTo(m *Message) error { - value := make([]byte, 0, errorCodeReasonMaxB) - if err := CheckOverflow(AttrErrorCode, - len(c.Reason)+errorCodeReasonStart, - errorCodeReasonMaxB+errorCodeReasonStart, - ); err != nil { - return err - } - value = value[:errorCodeReasonStart+len(c.Reason)] - number := byte(c.Code % errorCodeModulo) // error code modulo 100 - class := byte(c.Code / errorCodeModulo) // hundred digit - value[errorCodeClassByte] = class - value[errorCodeNumberByte] = number - copy(value[errorCodeReasonStart:], c.Reason) - m.Add(AttrErrorCode, value) - return nil -} - -// GetFrom decodes ERROR-CODE from m. Reason is valid until m.Raw is valid. -func (c *ErrorCodeAttribute) GetFrom(m *Message) error { - v, err := m.Get(AttrErrorCode) - if err != nil { - return err - } - if len(v) < errorCodeReasonStart { - return io.ErrUnexpectedEOF - } - var ( - class = uint16(v[errorCodeClassByte]) - number = uint16(v[errorCodeNumberByte]) - code = int(class*errorCodeModulo + number) - ) - c.Code = ErrorCode(code) - c.Reason = v[errorCodeReasonStart:] - return nil -} - -// ErrorCode is code for ERROR-CODE attribute. -type ErrorCode int - -// ErrNoDefaultReason means that default reason for provided error code -// is not defined in RFC. -var ErrNoDefaultReason = errors.New("no default reason for ErrorCode") - -// AddTo adds ERROR-CODE with default reason to m. If there -// is no default reason, returns ErrNoDefaultReason. -func (c ErrorCode) AddTo(m *Message) error { - reason := errorReasons[c] - if reason == nil { - return ErrNoDefaultReason - } - a := &ErrorCodeAttribute{ - Code: c, - Reason: reason, - } - return a.AddTo(m) -} - -// Possible error codes. -const ( - CodeTryAlternate ErrorCode = 300 - CodeBadRequest ErrorCode = 400 - CodeUnauthorised ErrorCode = 401 - CodeUnknownAttribute ErrorCode = 420 - CodeStaleNonce ErrorCode = 438 - CodeRoleConflict ErrorCode = 478 - CodeServerError ErrorCode = 500 -) - -// Error codes from RFC 5766. -// -// RFC 5766 Section 15 -const ( - CodeForbidden ErrorCode = 403 // Forbidden - CodeAllocMismatch ErrorCode = 437 // Allocation Mismatch - CodeWrongCredentials ErrorCode = 441 // Wrong Credentials - CodeUnsupportedTransProto ErrorCode = 442 // Unsupported Transport Protocol - CodeAllocQuotaReached ErrorCode = 486 // Allocation Quota Reached - CodeInsufficientCapacity ErrorCode = 508 // Insufficient Capacity -) - -// Error codes from RFC 6156. -// -// RFC 6156 Section 10.2 -const ( - CodeAddrFamilyNotSupported ErrorCode = 440 // Address Family not Supported - CodePeerAddrFamilyMismatch ErrorCode = 443 // Peer Address Family Mismatch -) - -var errorReasons = map[ErrorCode][]byte{ - CodeTryAlternate: []byte("Try Alternate"), - CodeBadRequest: []byte("Bad Request"), - CodeUnauthorised: []byte("Unauthorised"), - CodeUnknownAttribute: []byte("Unknown Attribute"), - CodeStaleNonce: []byte("Stale Nonce"), - CodeServerError: []byte("Server Error"), - CodeRoleConflict: []byte("Role Conflict"), - - // RFC 5766. - CodeForbidden: []byte("Forbidden"), - CodeAllocMismatch: []byte("Allocation Mismatch"), - CodeWrongCredentials: []byte("Wrong Credentials"), - CodeUnsupportedTransProto: []byte("Unsupported Transport Protocol"), - CodeAllocQuotaReached: []byte("Allocation Quota Reached"), - CodeInsufficientCapacity: []byte("Insufficient Capacity"), - - // RFC 6156. - CodeAddrFamilyNotSupported: []byte("Address Family not Supported"), - CodePeerAddrFamilyMismatch: []byte("Peer Address Family Mismatch"), -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/errors.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/errors.go deleted file mode 100644 index 029c9e4..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/errors.go +++ /dev/null @@ -1,62 +0,0 @@ -package stun - -import "errors" - -// DecodeErr records an error and place when it is occurred. -type DecodeErr struct { - Place DecodeErrPlace - Message string -} - -// IsInvalidCookie returns true if error means that magic cookie -// value is invalid. -func (e DecodeErr) IsInvalidCookie() bool { - return e.Place == DecodeErrPlace{"message", "cookie"} -} - -// IsPlaceParent reports if error place parent is p. -func (e DecodeErr) IsPlaceParent(p string) bool { - return e.Place.Parent == p -} - -// IsPlaceChildren reports if error place children is c. -func (e DecodeErr) IsPlaceChildren(c string) bool { - return e.Place.Children == c -} - -// IsPlace reports if error place is p. -func (e DecodeErr) IsPlace(p DecodeErrPlace) bool { - return e.Place == p -} - -// DecodeErrPlace records a place where error is occurred. -type DecodeErrPlace struct { - Parent string - Children string -} - -func (p DecodeErrPlace) String() string { - return p.Parent + "/" + p.Children -} - -func (e DecodeErr) Error() string { - return "BadFormat for " + e.Place.String() + ": " + e.Message -} - -func newDecodeErr(parent, children, message string) *DecodeErr { - return &DecodeErr{ - Place: DecodeErrPlace{Parent: parent, Children: children}, - Message: message, - } -} - -// TODO(ar): rewrite errors to be more precise. -func newAttrDecodeErr(children, message string) *DecodeErr { - return newDecodeErr("attribute", children, message) -} - -// ErrAttributeSizeInvalid means that decoded attribute size is invalid. -var ErrAttributeSizeInvalid = errors.New("attribute size is invalid") - -// ErrAttributeSizeOverflow means that decoded attribute size is too big. -var ErrAttributeSizeOverflow = errors.New("attribute size overflow") diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fingerprint.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fingerprint.go deleted file mode 100644 index 9777bb2..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fingerprint.go +++ /dev/null @@ -1,67 +0,0 @@ -package stun - -import ( - "errors" - "hash/crc32" -) - -// FingerprintAttr represents FINGERPRINT attribute. -// -// RFC 5389 Section 15.5 -type FingerprintAttr struct{} - -// ErrFingerprintMismatch means that computed fingerprint differs from expected. -var ErrFingerprintMismatch = errors.New("fingerprint check failed") - -// Fingerprint is shorthand for FingerprintAttr. -// -// Example: -// -// m := New() -// Fingerprint.AddTo(m) -var Fingerprint FingerprintAttr - -const ( - fingerprintXORValue uint32 = 0x5354554e - fingerprintSize = 4 // 32 bit -) - -// FingerprintValue returns CRC-32 of b XOR-ed by 0x5354554e. -// -// The value of the attribute is computed as the CRC-32 of the STUN message -// up to (but excluding) the FINGERPRINT attribute itself, XOR'ed with -// the 32-bit value 0x5354554e (the XOR helps in cases where an -// application packet is also using CRC-32 in it). -func FingerprintValue(b []byte) uint32 { - return crc32.ChecksumIEEE(b) ^ fingerprintXORValue // XOR -} - -// AddTo adds fingerprint to message. -func (FingerprintAttr) AddTo(m *Message) error { - l := m.Length - // length in header should include size of fingerprint attribute - m.Length += fingerprintSize + attributeHeaderSize // increasing length - m.WriteLength() // writing Length to Raw - b := make([]byte, fingerprintSize) - val := FingerprintValue(m.Raw) - bin.PutUint32(b, val) - m.Length = l - m.Add(AttrFingerprint, b) - return nil -} - -// Check reads fingerprint value from m and checks it, returning error if any. -// Can return *AttrLengthErr, ErrAttributeNotFound, and *CRCMismatch. -func (FingerprintAttr) Check(m *Message) error { - b, err := m.Get(AttrFingerprint) - if err != nil { - return err - } - if err = CheckSize(AttrFingerprint, len(b), fingerprintSize); err != nil { - return err - } - val := bin.Uint32(b) - attrStart := len(m.Raw) - (fingerprintSize + attributeHeaderSize) - expected := FingerprintValue(m.Raw[:attrStart]) - return checkFingerprint(val, expected) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fingerprint_debug.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fingerprint_debug.go deleted file mode 100644 index 6da074c..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fingerprint_debug.go +++ /dev/null @@ -1,18 +0,0 @@ -// +build debug - -package stun - -import "fmt" - -// CRCMismatch represents CRC check error. -type CRCMismatch struct { - Expected uint32 - Actual uint32 -} - -func (m CRCMismatch) Error() string { - return fmt.Sprintf("CRC mismatch: %x (expected) != %x (actual)", - m.Expected, - m.Actual, - ) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fuzz.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fuzz.go deleted file mode 100644 index 71790b1..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/fuzz.go +++ /dev/null @@ -1,140 +0,0 @@ -// +build gofuzz - -package stun - -import ( - "encoding/binary" - "fmt" -) - -var ( - m = New() -) - -// FuzzMessage is go-fuzz endpoint for message. -func FuzzMessage(data []byte) int { - m.Reset() - // fuzzer dont know about cookies - binary.BigEndian.PutUint32(data[4:8], magicCookie) - // trying to read data as message - if _, err := m.Write(data); err != nil { - return 0 - } - m2 := New() - if _, err := m2.Write(m.Raw); err != nil { - panic(err) - } - if m2.TransactionID != m.TransactionID { - panic("transaction ID mismatch") - } - if m2.Type != m.Type { - panic("type missmatch") - } - if len(m2.Attributes) != len(m.Attributes) { - panic("attributes length missmatch") - } - return 1 -} - -// FuzzType is go-fuzz endpoint for message type. -func FuzzType(data []byte) int { - t := MessageType{} - vt, _ := binary.Uvarint(data) - v := uint16(vt) & 0x1fff // first 3 bits are empty - t.ReadValue(v) - v2 := t.Value() - if v != v2 { - panic("v != v2") - } - t2 := MessageType{} - t2.ReadValue(v2) - if t2 != t { - panic("t2 != t") - } - return 0 -} - -type attr interface { - Getter - Setter -} - -type attrs []struct { - g attr - t AttrType -} - -func (a attrs) pick(v byte) struct { - g attr - t AttrType -} { - idx := int(v) % len(a) - return a[idx] -} - -func FuzzSetters(data []byte) int { - var ( - m1 = &Message{ - Raw: make([]byte, 0, 2048), - } - m2 = &Message{ - Raw: make([]byte, 0, 2048), - } - m3 = &Message{ - Raw: make([]byte, 0, 2048), - } - ) - attributes := attrs{ - {new(Realm), AttrRealm}, - {new(XORMappedAddress), AttrXORMappedAddress}, - {new(Nonce), AttrNonce}, - {new(Software), AttrSoftware}, - {new(AlternateServer), AttrAlternateServer}, - {new(ErrorCodeAttribute), AttrErrorCode}, - {new(UnknownAttributes), AttrUnknownAttributes}, - {new(Username), AttrUsername}, - {new(MappedAddress), AttrMappedAddress}, - {new(Realm), AttrRealm}, - } - var firstByte = byte(0) - if len(data) > 0 { - firstByte = data[0] - } - a := attributes.pick(firstByte) - value := data - if len(data) > 1 { - value = value[1:] - } - m1.WriteHeader() - m1.Add(a.t, value) - err := a.g.GetFrom(m1) - if err == ErrAttributeNotFound { - fmt.Println("unexpected 404") - panic(err) - } - if err != nil { - return 1 - } - m2.WriteHeader() - if err = a.g.AddTo(m2); err != nil { - // We allow decoding some text attributes - // when their length is too big, but - // not encoding. - if !IsAttrSizeOverflow(err) { - panic(err) - } - return 1 - } - m3.WriteHeader() - v, err := m2.Get(a.t) - if err != nil { - panic(err) - } - m3.Add(a.t, v) - - if !m2.Equal(m3) { - fmt.Println(m2, "not equal", m3) - panic("not equal") - } - return 1 -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/go.test.sh b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/go.test.sh deleted file mode 100755 index b4ffaf7..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/go.test.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -e -touch coverage.txt - -# test fuzz inputs -go test -tags gofuzz -run TestFuzz -v . - -# quick-test without -race -go test ./... - -# test with "debug" tag -go test -tags debug ./... - -# test concurrency -go test -race -cpu=1,2,4 -run TestClient_DoConcurrent - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/helpers.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/helpers.go deleted file mode 100644 index 6f848e3..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/helpers.go +++ /dev/null @@ -1,102 +0,0 @@ -package stun - -// Interfaces that are implemented by message attributes, shorthands for them, -// or helpers for message fields as type or transaction id. -type ( - // Setter sets *Message attribute. - Setter interface { - AddTo(m *Message) error - } - // Getter parses attribute from *Message. - Getter interface { - GetFrom(m *Message) error - } - // Checker checks *Message attribute. - Checker interface { - Check(m *Message) error - } -) - -// Build resets message and applies setters to it in batch, returning on -// first error. To prevent allocations, pass pointers to values. -// -// Example: -// var ( -// t = BindingRequest -// username = NewUsername("username") -// nonce = NewNonce("nonce") -// realm = NewRealm("example.org") -// ) -// m := new(Message) -// m.Build(t, username, nonce, realm) // 4 allocations -// m.Build(&t, &username, &nonce, &realm) // 0 allocations -// -// See BenchmarkBuildOverhead. -func (m *Message) Build(setters ...Setter) error { - m.Reset() - m.WriteHeader() - for _, s := range setters { - if err := s.AddTo(m); err != nil { - return err - } - } - return nil -} - -// Check applies checkers to message in batch, returning on first error. -func (m *Message) Check(checkers ...Checker) error { - for _, c := range checkers { - if err := c.Check(m); err != nil { - return err - } - } - return nil -} - -// Parse applies getters to message in batch, returning on first error. -func (m *Message) Parse(getters ...Getter) error { - for _, c := range getters { - if err := c.GetFrom(m); err != nil { - return err - } - } - return nil -} - -// MustBuild wraps Build call and panics on error. -func MustBuild(setters ...Setter) *Message { - m, err := Build(setters...) - if err != nil { - panic(err) - } - return m -} - -// Build wraps Message.Build method. -func Build(setters ...Setter) (*Message, error) { - m := new(Message) - return m, m.Build(setters...) -} - -// ForEach is helper that iterates over message attributes allowing to call -// Getter in f callback to get all attributes of type t and returning on first -// f error. -// -// The m.Get method inside f will be returning next attribute on each f call. -// Does not error if there are no results. -func (m *Message) ForEach(t AttrType, f func(m *Message) error) error { - attrs := m.Attributes - defer func() { - m.Attributes = attrs - }() - for i, a := range attrs { - if a.Type != t { - continue - } - m.Attributes = attrs[i:] - if err := f(m); err != nil { - return err - } - } - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/integrity.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/integrity.go deleted file mode 100644 index e092acd..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/integrity.go +++ /dev/null @@ -1,131 +0,0 @@ -package stun - -import ( - "crypto/md5" // #nosec - "crypto/sha1" - "errors" - "fmt" - "strings" - - "github.com/gortc/stun/internal/hmac" -) - -// separator for credentials. -const credentialsSep = ":" - -// NewLongTermIntegrity returns new MessageIntegrity with key for long-term -// credentials. Password, username, and realm must be SASL-prepared. -func NewLongTermIntegrity(username, realm, password string) MessageIntegrity { - k := strings.Join( - []string{ - username, - realm, - password, - }, - credentialsSep, - ) - // #nosec - h := md5.New() - fmt.Fprint(h, k) - return MessageIntegrity(h.Sum(nil)) -} - -// NewShortTermIntegrity returns new MessageIntegrity with key for short-term -// credentials. Password must be SASL-prepared. -func NewShortTermIntegrity(password string) MessageIntegrity { - return MessageIntegrity(password) -} - -// MessageIntegrity represents MESSAGE-INTEGRITY attribute. AddTo and GetFrom -// methods will allocate memory for cryptographic functions. Zero-allocation -// version of MessageIntegrity is not implemented. Implementation and changes -// to it is subject to security review. -// -// RFC 5389 Section 15.4 -type MessageIntegrity []byte - -// ErrFingerprintBeforeIntegrity means that FINGEPRINT attribute is already in -// message, so MESSAGE-INTEGRITY attribute cannot be added. -var ErrFingerprintBeforeIntegrity = errors.New( - "FINGERPRINT before MESSAGE-INTEGRITY attribute", -) - -func (i MessageIntegrity) String() string { - return fmt.Sprintf("KEY: 0x%x", []byte(i)) -} - -const messageIntegritySize = 20 - -// AddTo adds MESSAGE-INTEGRITY attribute to message. Be advised, CPU -// and allocations costly, can be cause of DOS. -func (i MessageIntegrity) AddTo(m *Message) error { - for _, a := range m.Attributes { - // Message should not contain FINGERPRINT attribute - // before MESSAGE-INTEGRITY. - if a.Type == AttrFingerprint { - return ErrFingerprintBeforeIntegrity - } - } - // The text used as input to HMAC is the STUN message, - // including the header, up to and including the attribute preceding the - // MESSAGE-INTEGRITY attribute. - length := m.Length - // Adjusting m.Length to contain MESSAGE-INTEGRITY TLV. - m.Length += messageIntegritySize + attributeHeaderSize - m.WriteLength() // writing length to m.Raw - v := newHMAC(i, m.Raw, m.Raw[len(m.Raw):]) // calculating HMAC for adjusted m.Raw - m.Length = length // changing m.Length back - - // Copy hmac value to temporary variable to protect it from resetting - // while processing m.Add call. - vBuf := make([]byte, sha1.Size) - copy(vBuf, v) - - m.Add(AttrMessageIntegrity, vBuf) - return nil -} - -// ErrIntegrityMismatch means that computed HMAC differs from expected. -var ErrIntegrityMismatch = errors.New("integrity check failed") - -func newHMAC(key, message, buf []byte) []byte { - mac := hmac.AcquireSHA1(key) - writeOrPanic(mac, message) - defer hmac.PutSHA1(mac) - return mac.Sum(buf) -} - -// Check checks MESSAGE-INTEGRITY attribute. Be advised, CPU and allocations -// costly, can be cause of DOS. -func (i MessageIntegrity) Check(m *Message) error { - v, err := m.Get(AttrMessageIntegrity) - if err != nil { - return err - } - - // Adjusting length in header to match m.Raw that was - // used when computing HMAC. - var ( - length = m.Length - afterIntegrity = false - sizeReduced int - ) - for _, a := range m.Attributes { - if afterIntegrity { - sizeReduced += nearestPaddedValueLength(int(a.Length)) - sizeReduced += attributeHeaderSize - } - if a.Type == AttrMessageIntegrity { - afterIntegrity = true - } - } - m.Length -= uint32(sizeReduced) - m.WriteLength() - // startOfHMAC should be first byte of integrity attribute. - startOfHMAC := messageHeaderSize + m.Length - (attributeHeaderSize + messageIntegritySize) - b := m.Raw[:startOfHMAC] // data before integrity attribute - expected := newHMAC(i, b, m.Raw[len(m.Raw):]) - m.Length = length - m.WriteLength() // writing length back - return checkHMAC(v, expected) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/integrity_debug.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/integrity_debug.go deleted file mode 100644 index 6b8a303..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/integrity_debug.go +++ /dev/null @@ -1,18 +0,0 @@ -// +build debug - -package stun - -import "fmt" - -// IntegrityErr occurs when computed HMAC differs from expected. -type IntegrityErr struct { - Expected []byte - Actual []byte -} - -func (i *IntegrityErr) Error() string { - return fmt.Sprintf( - "Integrity check failed: 0x%x (expected) !- 0x%x (actual)", - i.Expected, i.Actual, - ) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/hmac.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/hmac.go deleted file mode 100644 index c8c0617..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/hmac.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as -defined in U.S. Federal Information Processing Standards Publication 198. -An HMAC is a cryptographic hash that uses a key to sign a message. -The receiver verifies the hash by recomputing it using the same key. - -Receivers should be careful to use Equal to compare MACs in order to avoid -timing side-channels: - - // CheckMAC reports whether messageMAC is a valid HMAC tag for message. - func CheckMAC(message, messageMAC, key []byte) bool { - mac := hmac.New(sha256.New, key) - mac.Write(message) - expectedMAC := mac.Sum(nil) - return hmac.Equal(messageMAC, expectedMAC) - } -*/ -package hmac - -import ( - "crypto/subtle" - "hash" -) - -// FIPS 198-1: -// https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf - -// key is zero padded to the block size of the hash function -// ipad = 0x36 byte repeated for key length -// opad = 0x5c byte repeated for key length -// hmac = H([key ^ opad] H([key ^ ipad] text)) - -type hmac struct { - size int - blocksize int - opad, ipad []byte - outer, inner hash.Hash -} - -func (h *hmac) Sum(in []byte) []byte { - origLen := len(in) - in = h.inner.Sum(in) - h.outer.Reset() - h.outer.Write(h.opad) - h.outer.Write(in[origLen:]) - return h.outer.Sum(in[:origLen]) -} - -func (h *hmac) Write(p []byte) (n int, err error) { - return h.inner.Write(p) -} - -func (h *hmac) Size() int { return h.size } - -func (h *hmac) BlockSize() int { return h.blocksize } - -func (h *hmac) Reset() { - h.inner.Reset() - h.inner.Write(h.ipad) -} - -// New returns a new HMAC hash using the given hash.Hash type and key. -// Note that unlike other hash implementations in the standard library, -// the returned Hash does not implement encoding.BinaryMarshaler -// or encoding.BinaryUnmarshaler. -func New(h func() hash.Hash, key []byte) hash.Hash { - hm := new(hmac) - hm.outer = h() - hm.inner = h() - hm.size = hm.inner.Size() - hm.blocksize = hm.inner.BlockSize() - hm.ipad = make([]byte, hm.blocksize) - hm.opad = make([]byte, hm.blocksize) - if len(key) > hm.blocksize { - // If key is too big, hash it. - hm.outer.Write(key) - key = hm.outer.Sum(nil) - } - copy(hm.ipad, key) - copy(hm.opad, key) - for i := range hm.ipad { - hm.ipad[i] ^= 0x36 - } - for i := range hm.opad { - hm.opad[i] ^= 0x5c - } - hm.inner.Write(hm.ipad) - return hm -} - -// Equal compares two MACs for equality without leaking timing information. -func Equal(mac1, mac2 []byte) bool { - // We don't have to be constant time if the lengths of the MACs are - // different as that suggests that a completely different hash function - // was used. - return subtle.ConstantTimeCompare(mac1, mac2) == 1 -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/pool.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/pool.go deleted file mode 100644 index 62d9240..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/pool.go +++ /dev/null @@ -1,92 +0,0 @@ -package hmac - -import ( - "crypto/sha1" - "crypto/sha256" - "hash" - "sync" -) - -// setZeroes sets all bytes from b to zeroes. -// -// See https://github.com/golang/go/issues/5373 -func setZeroes(b []byte) { - for i := range b { - b[i] = 0 - } -} - -func (h *hmac) resetTo(key []byte) { - h.outer.Reset() - h.inner.Reset() - setZeroes(h.ipad) - setZeroes(h.opad) - if len(key) > h.blocksize { - // If key is too big, hash it. - h.outer.Write(key) - key = h.outer.Sum(nil) - } - copy(h.ipad, key) - copy(h.opad, key) - for i := range h.ipad { - h.ipad[i] ^= 0x36 - } - for i := range h.opad { - h.opad[i] ^= 0x5c - } - h.inner.Write(h.ipad) -} - -var hmacSHA1Pool = &sync.Pool{ - New: func() interface{} { - h := New(sha1.New, make([]byte, sha1.BlockSize)) - return h - }, -} - -// AcquireSHA1 returns new HMAC from pool. -func AcquireSHA1(key []byte) hash.Hash { - h := hmacSHA1Pool.Get().(*hmac) - assertHMACSize(h, sha1.Size, sha1.BlockSize) - h.resetTo(key) - return h -} - -// PutSHA1 puts h to pool. -func PutSHA1(h hash.Hash) { - hm := h.(*hmac) - assertHMACSize(hm, sha1.Size, sha1.BlockSize) - hmacSHA1Pool.Put(hm) -} - -var hmacSHA256Pool = &sync.Pool{ - New: func() interface{} { - h := New(sha256.New, make([]byte, sha256.BlockSize)) - return h - }, -} - -// AcquireSHA256 returns new HMAC from SHA256 pool. -func AcquireSHA256(key []byte) hash.Hash { - h := hmacSHA256Pool.Get().(*hmac) - assertHMACSize(h, sha256.Size, sha256.BlockSize) - h.resetTo(key) - return h -} - -// PutSHA256 puts h to SHA256 pool. -func PutSHA256(h hash.Hash) { - hm := h.(*hmac) - assertHMACSize(hm, sha256.Size, sha256.BlockSize) - hmacSHA256Pool.Put(hm) -} - -// assertHMACSize panics if h.size != size or h.blocksize != blocksize. -// -// Put and Acquire functions are internal functions to project, so -// checking it via such assert is optimal. -func assertHMACSize(h *hmac, size, blocksize int) { - if h.size != size || h.blocksize != blocksize { - panic("BUG: hmac size invalid") - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/vendor.sh b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/vendor.sh deleted file mode 100755 index 83a2b32..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/internal/hmac/vendor.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -cp -v $GOROOT/src/crypto/hmac/{hmac,hmac_test}.go . -git diff {hmac,hmac_test}.go - diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/message.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/message.go deleted file mode 100644 index d306371..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/message.go +++ /dev/null @@ -1,596 +0,0 @@ -package stun - -import ( - "crypto/rand" - "encoding/base64" - "errors" - "fmt" - "io" -) - -const ( - // magicCookie is fixed value that aids in distinguishing STUN packets - // from packets of other protocols when STUN is multiplexed with those - // other protocols on the same Port. - // - // The magic cookie field MUST contain the fixed value 0x2112A442 in - // network byte order. - // - // Defined in "STUN Message Structure", section 6. - magicCookie = 0x2112A442 - attributeHeaderSize = 4 - messageHeaderSize = 20 - - // TransactionIDSize is length of transaction id array (in bytes). - TransactionIDSize = 12 // 96 bit -) - -// NewTransactionID returns new random transaction ID using crypto/rand -// as source. -func NewTransactionID() (b [TransactionIDSize]byte) { - readFullOrPanic(rand.Reader, b[:]) - return b -} - -// IsMessage returns true if b looks like STUN message. -// Useful for multiplexing. IsMessage does not guarantee -// that decoding will be successful. -func IsMessage(b []byte) bool { - return len(b) >= messageHeaderSize && bin.Uint32(b[4:8]) == magicCookie -} - -// New returns *Message with pre-allocated Raw. -func New() *Message { - const defaultRawCapacity = 120 - return &Message{ - Raw: make([]byte, messageHeaderSize, defaultRawCapacity), - } -} - -// ErrDecodeToNil occurs on Decode(data, nil) call. -var ErrDecodeToNil = errors.New("attempt to decode to nil message") - -// Decode decodes Message from data to m, returning error if any. -func Decode(data []byte, m *Message) error { - if m == nil { - return ErrDecodeToNil - } - m.Raw = append(m.Raw[:0], data...) - return m.Decode() -} - -// Message represents a single STUN packet. It uses aggressive internal -// buffering to enable zero-allocation encoding and decoding, -// so there are some usage constraints: -// -// Message, its fields, results of m.Get or any attribute a.GetFrom -// are valid only until Message.Raw is not modified. -type Message struct { - Type MessageType - Length uint32 // len(Raw) not including header - TransactionID [TransactionIDSize]byte - Attributes Attributes - Raw []byte -} - -// AddTo sets b.TransactionID to m.TransactionID. -// -// Implements Setter to aid in crafting responses. -func (m *Message) AddTo(b *Message) error { - b.TransactionID = m.TransactionID - b.WriteTransactionID() - return nil -} - -// NewTransactionID sets m.TransactionID to random value from crypto/rand -// and returns error if any. -func (m *Message) NewTransactionID() error { - _, err := io.ReadFull(rand.Reader, m.TransactionID[:]) - if err == nil { - m.WriteTransactionID() - } - return err -} - -func (m *Message) String() string { - return fmt.Sprintf("%s l=%d attrs=%d id=%s", - m.Type, - m.Length, - len(m.Attributes), - base64.StdEncoding.EncodeToString(m.TransactionID[:]), - ) -} - -// Reset resets Message, attributes and underlying buffer length. -func (m *Message) Reset() { - m.Raw = m.Raw[:0] - m.Length = 0 - m.Attributes = m.Attributes[:0] -} - -// grow ensures that internal buffer will fit v more bytes and -// increases it capacity if necessary. -func (m *Message) grow(v int) { - // Not performing any optimizations here - // (e.g. preallocate len(buf) * 2 to reduce allocations) - // because they are already done by []byte implementation. - n := len(m.Raw) + v - for cap(m.Raw) < n { - m.Raw = append(m.Raw, 0) - } - m.Raw = m.Raw[:n] -} - -// Add appends new attribute to message. Not goroutine-safe. -// -// Value of attribute is copied to internal buffer so -// it is safe to reuse v. -func (m *Message) Add(t AttrType, v []byte) { - // Allocating buffer for TLV (type-length-value). - // T = t, L = len(v), V = v. - // m.Raw will look like: - // [0:20] <- message header - // [20:20+m.Length] <- existing message attributes - // [20+m.Length:20+m.Length+len(v) + 4] <- allocated buffer for new TLV - // [first:last] <- same as previous - // [0 1|2 3|4 4 + len(v)] <- mapping for allocated buffer - // T L V - allocSize := attributeHeaderSize + len(v) // len(TLV) = len(TL) + len(V) - first := messageHeaderSize + int(m.Length) // first byte number - last := first + allocSize // last byte number - m.grow(last) // growing cap(Raw) to fit TLV - m.Raw = m.Raw[:last] // now len(Raw) = last - m.Length += uint32(allocSize) // rendering length change - - // Sub-slicing internal buffer to simplify encoding. - buf := m.Raw[first:last] // slice for TLV - value := buf[attributeHeaderSize:] // slice for V - attr := RawAttribute{ - Type: t, // T - Length: uint16(len(v)), // L - Value: value, // V - } - - // Encoding attribute TLV to allocated buffer. - bin.PutUint16(buf[0:2], attr.Type.Value()) // T - bin.PutUint16(buf[2:4], attr.Length) // L - copy(value, v) // V - - // Checking that attribute value needs padding. - if attr.Length%padding != 0 { - // Performing padding. - bytesToAdd := nearestPaddedValueLength(len(v)) - len(v) - last += bytesToAdd - m.grow(last) - // setting all padding bytes to zero - // to prevent data leak from previous - // data in next bytesToAdd bytes - buf = m.Raw[last-bytesToAdd : last] - for i := range buf { - buf[i] = 0 - } - m.Raw = m.Raw[:last] // increasing buffer length - m.Length += uint32(bytesToAdd) // rendering length change - } - m.Attributes = append(m.Attributes, attr) - m.WriteLength() -} - -func attrSliceEqual(a, b Attributes) bool { - for _, attr := range a { - found := false - for _, attrB := range b { - if attrB.Type != attr.Type { - continue - } - if attrB.Equal(attr) { - found = true - break - } - } - if !found { - return false - } - } - return true -} - -func attrEqual(a, b Attributes) bool { - if a == nil && b == nil { - return true - } - if a == nil || b == nil { - return false - } - if len(a) != len(b) { - return false - } - if !attrSliceEqual(a, b) { - return false - } - if !attrSliceEqual(b, a) { - return false - } - return true -} - -// Equal returns true if Message b equals to m. -// Ignores m.Raw. -func (m *Message) Equal(b *Message) bool { - if m == nil && b == nil { - return true - } - if m == nil || b == nil { - return false - } - if m.Type != b.Type { - return false - } - if m.TransactionID != b.TransactionID { - return false - } - if m.Length != b.Length { - return false - } - if !attrEqual(m.Attributes, b.Attributes) { - return false - } - return true -} - -// WriteLength writes m.Length to m.Raw. Call is valid only if len(m.Raw) >= 4. -func (m *Message) WriteLength() { - _ = m.Raw[4] // early bounds check to guarantee safety of writes below - bin.PutUint16(m.Raw[2:4], uint16(m.Length)) -} - -// WriteHeader writes header to underlying buffer. Not goroutine-safe. -func (m *Message) WriteHeader() { - if len(m.Raw) < messageHeaderSize { - // Making WriteHeader call valid even when m.Raw - // is nil or len(m.Raw) is less than needed for header. - m.grow(messageHeaderSize) - } - _ = m.Raw[:messageHeaderSize] // early bounds check to guarantee safety of writes below - - m.WriteType() - m.WriteLength() - bin.PutUint32(m.Raw[4:8], magicCookie) // magic cookie - copy(m.Raw[8:messageHeaderSize], m.TransactionID[:]) // transaction ID -} - -// WriteTransactionID writes m.TransactionID to m.Raw. -func (m *Message) WriteTransactionID() { - copy(m.Raw[8:messageHeaderSize], m.TransactionID[:]) // transaction ID -} - -// WriteAttributes encodes all m.Attributes to m. -func (m *Message) WriteAttributes() { - attributes := m.Attributes - m.Attributes = attributes[:0] - for _, a := range attributes { - m.Add(a.Type, a.Value) - } - m.Attributes = attributes -} - -// WriteType writes m.Type to m.Raw. -func (m *Message) WriteType() { - bin.PutUint16(m.Raw[0:2], m.Type.Value()) // message type -} - -// SetType sets m.Type and writes it to m.Raw. -func (m *Message) SetType(t MessageType) { - m.Type = t - m.WriteType() -} - -// Encode re-encodes message into m.Raw. -func (m *Message) Encode() { - m.Raw = m.Raw[:0] - m.WriteHeader() - m.Length = 0 - m.WriteAttributes() -} - -// WriteTo implements WriterTo via calling Write(m.Raw) on w and returning -// call result. -func (m *Message) WriteTo(w io.Writer) (int64, error) { - n, err := w.Write(m.Raw) - return int64(n), err -} - -// ReadFrom implements ReaderFrom. Reads message from r into m.Raw, -// Decodes it and return error if any. If m.Raw is too small, will return -// ErrUnexpectedEOF, ErrUnexpectedHeaderEOF or *DecodeErr. -// -// Can return *DecodeErr while decoding too. -func (m *Message) ReadFrom(r io.Reader) (int64, error) { - tBuf := m.Raw[:cap(m.Raw)] - var ( - n int - err error - ) - if n, err = r.Read(tBuf); err != nil { - return int64(n), err - } - m.Raw = tBuf[:n] - return int64(n), m.Decode() -} - -// ErrUnexpectedHeaderEOF means that there were not enough bytes in -// m.Raw to read header. -var ErrUnexpectedHeaderEOF = errors.New("unexpected EOF: not enough bytes to read header") - -// Decode decodes m.Raw into m. -func (m *Message) Decode() error { - // decoding message header - buf := m.Raw - if len(buf) < messageHeaderSize { - return ErrUnexpectedHeaderEOF - } - var ( - t = bin.Uint16(buf[0:2]) // first 2 bytes - size = int(bin.Uint16(buf[2:4])) // second 2 bytes - cookie = bin.Uint32(buf[4:8]) // last 4 bytes - fullSize = messageHeaderSize + size // len(m.Raw) - ) - if cookie != magicCookie { - msg := fmt.Sprintf( - "%x is invalid magic cookie (should be %x)", - cookie, magicCookie, - ) - return newDecodeErr("message", "cookie", msg) - } - if len(buf) < fullSize { - msg := fmt.Sprintf( - "buffer length %d is less than %d (expected message size)", - len(buf), fullSize, - ) - return newAttrDecodeErr("message", msg) - } - // saving header data - m.Type.ReadValue(t) - m.Length = uint32(size) - copy(m.TransactionID[:], buf[8:messageHeaderSize]) - - m.Attributes = m.Attributes[:0] - var ( - offset = 0 - b = buf[messageHeaderSize:fullSize] - ) - for offset < size { - // checking that we have enough bytes to read header - if len(b) < attributeHeaderSize { - msg := fmt.Sprintf( - "buffer length %d is less than %d (expected header size)", - len(b), attributeHeaderSize, - ) - return newAttrDecodeErr("header", msg) - } - var ( - a = RawAttribute{ - Type: AttrType(bin.Uint16(b[0:2])), // first 2 bytes - Length: bin.Uint16(b[2:4]), // second 2 bytes - } - aL = int(a.Length) // attribute length - aBuffL = nearestPaddedValueLength(aL) // expected buffer length (with padding) - ) - b = b[attributeHeaderSize:] // slicing again to simplify value read - offset += attributeHeaderSize - if len(b) < aBuffL { // checking size - msg := fmt.Sprintf( - "buffer length %d is less than %d (expected value size for %s)", - len(b), aBuffL, a.Type, - ) - return newAttrDecodeErr("value", msg) - } - a.Value = b[:aL] - offset += aBuffL - b = b[aBuffL:] - - m.Attributes = append(m.Attributes, a) - } - return nil -} - -// Write decodes message and return error if any. -// -// Any error is unrecoverable, but message could be partially decoded. -func (m *Message) Write(tBuf []byte) (int, error) { - m.Raw = append(m.Raw[:0], tBuf...) - return len(tBuf), m.Decode() -} - -// CloneTo clones m to b securing any further m mutations. -func (m *Message) CloneTo(b *Message) error { - // TODO(ar): implement low-level copy. - b.Raw = append(b.Raw[:0], m.Raw...) - return b.Decode() -} - -// MessageClass is 8-bit representation of 2-bit class of STUN Message Class. -type MessageClass byte - -// Possible values for message class in STUN Message Type. -const ( - ClassRequest MessageClass = 0x00 // 0b00 - ClassIndication MessageClass = 0x01 // 0b01 - ClassSuccessResponse MessageClass = 0x02 // 0b10 - ClassErrorResponse MessageClass = 0x03 // 0b11 -) - -// Common STUN message types. -var ( - // Binding request message type. - BindingRequest = NewType(MethodBinding, ClassRequest) - // Binding success response message type - BindingSuccess = NewType(MethodBinding, ClassSuccessResponse) - // Binding error response message type. - BindingError = NewType(MethodBinding, ClassErrorResponse) -) - -func (c MessageClass) String() string { - switch c { - case ClassRequest: - return "request" - case ClassIndication: - return "indication" - case ClassSuccessResponse: - return "success response" - case ClassErrorResponse: - return "error response" - default: - panic("unknown message class") - } -} - -// Method is uint16 representation of 12-bit STUN method. -type Method uint16 - -// Possible methods for STUN Message. -const ( - MethodBinding Method = 0x001 - MethodAllocate Method = 0x003 - MethodRefresh Method = 0x004 - MethodSend Method = 0x006 - MethodData Method = 0x007 - MethodCreatePermission Method = 0x008 - MethodChannelBind Method = 0x009 -) - -var methodName = map[Method]string{ - MethodBinding: "binding", - MethodAllocate: "allocate", - MethodRefresh: "refresh", - MethodSend: "send", - MethodData: "data", - MethodCreatePermission: "create permission", - MethodChannelBind: "channel bind", -} - -func (m Method) String() string { - s, ok := methodName[m] - if !ok { - // Falling back to hex representation. - s = fmt.Sprintf("0x%x", uint16(m)) - } - return s -} - -// MessageType is STUN Message Type Field. -type MessageType struct { - Method Method // e.g. binding - Class MessageClass // e.g. request -} - -// AddTo sets m type to t. -func (t MessageType) AddTo(m *Message) error { - m.SetType(t) - return nil -} - -// NewType returns new message type with provided method and class. -func NewType(method Method, class MessageClass) MessageType { - return MessageType{ - Method: method, - Class: class, - } -} - -const ( - methodABits = 0xf // 0b0000000000001111 - methodBBits = 0x70 // 0b0000000001110000 - methodDBits = 0xf80 // 0b0000111110000000 - - methodBShift = 1 - methodDShift = 2 - - firstBit = 0x1 - secondBit = 0x2 - - c0Bit = firstBit - c1Bit = secondBit - - classC0Shift = 4 - classC1Shift = 7 -) - -// Value returns bit representation of messageType. -func (t MessageType) Value() uint16 { - // 0 1 - // 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - // +--+--+-+-+-+-+-+-+-+-+-+-+-+-+ - // |M |M |M|M|M|C|M|M|M|C|M|M|M|M| - // |11|10|9|8|7|1|6|5|4|0|3|2|1|0| - // +--+--+-+-+-+-+-+-+-+-+-+-+-+-+ - // Figure 3: Format of STUN Message Type Field - - // Warning: Abandon all hope ye who enter here. - // Splitting M into A(M0-M3), B(M4-M6), D(M7-M11). - m := uint16(t.Method) - a := m & methodABits // A = M * 0b0000000000001111 (right 4 bits) - b := m & methodBBits // B = M * 0b0000000001110000 (3 bits after A) - d := m & methodDBits // D = M * 0b0000111110000000 (5 bits after B) - - // Shifting to add "holes" for C0 (at 4 bit) and C1 (8 bit). - m = a + (b << methodBShift) + (d << methodDShift) - - // C0 is zero bit of C, C1 is first bit. - // C0 = C * 0b01, C1 = (C * 0b10) >> 1 - // Ct = C0 << 4 + C1 << 8. - // Optimizations: "((C * 0b10) >> 1) << 8" as "(C * 0b10) << 7" - // We need C0 shifted by 4, and C1 by 8 to fit "11" and "7" positions - // (see figure 3). - c := uint16(t.Class) - c0 := (c & c0Bit) << classC0Shift - c1 := (c & c1Bit) << classC1Shift - class := c0 + c1 - - return m + class -} - -// ReadValue decodes uint16 into MessageType. -func (t *MessageType) ReadValue(v uint16) { - // Decoding class. - // We are taking first bit from v >> 4 and second from v >> 7. - c0 := (v >> classC0Shift) & c0Bit - c1 := (v >> classC1Shift) & c1Bit - class := c0 + c1 - t.Class = MessageClass(class) - - // Decoding method. - a := v & methodABits // A(M0-M3) - b := (v >> methodBShift) & methodBBits // B(M4-M6) - d := (v >> methodDShift) & methodDBits // D(M7-M11) - m := a + b + d - t.Method = Method(m) -} - -func (t MessageType) String() string { - return fmt.Sprintf("%s %s", t.Method, t.Class) -} - -// Contains return true if message contain t attribute. -func (m *Message) Contains(t AttrType) bool { - for _, a := range m.Attributes { - if a.Type == t { - return true - } - } - return false -} - -type transactionIDValueSetter [TransactionIDSize]byte - -// NewTransactionIDSetter returns new Setter that sets message transaction id -// to provided value. -func NewTransactionIDSetter(value [TransactionIDSize]byte) Setter { - return transactionIDValueSetter(value) -} - -func (t transactionIDValueSetter) AddTo(m *Message) error { - m.TransactionID = t - m.WriteTransactionID() - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/stun.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/stun.go deleted file mode 100644 index b9be735..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/stun.go +++ /dev/null @@ -1,51 +0,0 @@ -// Package stun implements Session Traversal Utilities for NAT (STUN) RFC 5389. -// -// The stun package is intended to use by package that implements extension -// to STUN (e.g. TURN) or client/server applications. -// -// Most methods are designed to be zero allocations. If it is not enough, -// low-level methods are available. On other hand, there are helpers that -// reduce code repeat. -// -// See examples for Message for basic usage, or https://github.com/gortc/turn -// package for example of stun extension implementation. -package stun - -import ( - "encoding/binary" - "io" -) - -// bin is shorthand to binary.BigEndian. -var bin = binary.BigEndian - -func readFullOrPanic(r io.Reader, v []byte) int { - n, err := io.ReadFull(r, v) - if err != nil { - panic(err) - } - return n -} - -func writeOrPanic(w io.Writer, v []byte) int { - n, err := w.Write(v) - if err != nil { - panic(err) - } - return n -} - -// IANA assigned ports for "stun" protocol. -const ( - DefaultPort = 3478 - DefaultTLSPort = 5349 -) - -type transactionIDSetter struct{} - -func (transactionIDSetter) AddTo(m *Message) error { - return m.NewTransactionID() -} - -// TransactionID is Setter for m.TransactionID. -var TransactionID Setter = transactionIDSetter{} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/textattrs.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/textattrs.go deleted file mode 100644 index 69ca58a..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/textattrs.go +++ /dev/null @@ -1,129 +0,0 @@ -package stun - -// NewUsername returns Username with provided value. -func NewUsername(username string) Username { - return Username(username) -} - -// Username represents USERNAME attribute. -// -// RFC 5389 Section 15.3 -type Username []byte - -func (u Username) String() string { - return string(u) -} - -const maxUsernameB = 513 - -// AddTo adds USERNAME attribute to message. -func (u Username) AddTo(m *Message) error { - return TextAttribute(u).AddToAs(m, AttrUsername, maxUsernameB) -} - -// GetFrom gets USERNAME from message. -func (u *Username) GetFrom(m *Message) error { - return (*TextAttribute)(u).GetFromAs(m, AttrUsername) -} - -// NewRealm returns Realm with provided value. -// Must be SASL-prepared. -func NewRealm(realm string) Realm { - return Realm(realm) -} - -// Realm represents REALM attribute. -// -// RFC 5389 Section 15.7 -type Realm []byte - -func (n Realm) String() string { - return string(n) -} - -const maxRealmB = 763 - -// AddTo adds NONCE to message. -func (n Realm) AddTo(m *Message) error { - return TextAttribute(n).AddToAs(m, AttrRealm, maxRealmB) -} - -// GetFrom gets REALM from message. -func (n *Realm) GetFrom(m *Message) error { - return (*TextAttribute)(n).GetFromAs(m, AttrRealm) -} - -const softwareRawMaxB = 763 - -// Software is SOFTWARE attribute. -// -// RFC 5389 Section 15.10 -type Software []byte - -func (s Software) String() string { - return string(s) -} - -// NewSoftware returns *Software from string. -func NewSoftware(software string) Software { - return Software(software) -} - -// AddTo adds Software attribute to m. -func (s Software) AddTo(m *Message) error { - return TextAttribute(s).AddToAs(m, AttrSoftware, softwareRawMaxB) -} - -// GetFrom decodes Software from m. -func (s *Software) GetFrom(m *Message) error { - return (*TextAttribute)(s).GetFromAs(m, AttrSoftware) -} - -// Nonce represents NONCE attribute. -// -// RFC 5389 Section 15.8 -type Nonce []byte - -// NewNonce returns new Nonce from string. -func NewNonce(nonce string) Nonce { - return Nonce(nonce) -} - -func (n Nonce) String() string { - return string(n) -} - -const maxNonceB = 763 - -// AddTo adds NONCE to message. -func (n Nonce) AddTo(m *Message) error { - return TextAttribute(n).AddToAs(m, AttrNonce, maxNonceB) -} - -// GetFrom gets NONCE from message. -func (n *Nonce) GetFrom(m *Message) error { - return (*TextAttribute)(n).GetFromAs(m, AttrNonce) -} - -// TextAttribute is helper for adding and getting text attributes. -type TextAttribute []byte - -// AddToAs adds attribute with type t to m, checking maximum length. If maxLen -// is less than 0, no check is performed. -func (v TextAttribute) AddToAs(m *Message, t AttrType, maxLen int) error { - if err := CheckOverflow(t, len(v), maxLen); err != nil { - return err - } - m.Add(t, v) - return nil -} - -// GetFromAs gets t attribute from m and appends its value to reseted v. -func (v *TextAttribute) GetFromAs(m *Message, t AttrType) error { - a, err := m.Get(t) - if err != nil { - return err - } - *v = append((*v)[:0], a...) - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/uattrs.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/uattrs.go deleted file mode 100644 index 25a9854..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/uattrs.go +++ /dev/null @@ -1,65 +0,0 @@ -package stun - -import "errors" - -// UnknownAttributes represents UNKNOWN-ATTRIBUTES attribute. -// -// RFC 5389 Section 15.9 -type UnknownAttributes []AttrType - -func (a UnknownAttributes) String() string { - s := "" - if len(a) == 0 { - return "" - } - last := len(a) - 1 - for i, t := range a { - s += t.String() - if i != last { - s += ", " - } - } - return s -} - -// type size is 16 bit. -const attrTypeSize = 4 - -// AddTo adds UNKNOWN-ATTRIBUTES attribute to message. -func (a UnknownAttributes) AddTo(m *Message) error { - v := make([]byte, 0, attrTypeSize*20) // 20 should be enough - // If len(a.Types) > 20, there will be allocations. - for i, t := range a { - v = append(v, 0, 0, 0, 0) // 4 times by 0 (16 bits) - first := attrTypeSize * i - last := first + attrTypeSize - bin.PutUint16(v[first:last], t.Value()) - } - m.Add(AttrUnknownAttributes, v) - return nil -} - -// ErrBadUnknownAttrsSize means that UNKNOWN-ATTRIBUTES attribute value -// has invalid length. -var ErrBadUnknownAttrsSize = errors.New("bad UNKNOWN-ATTRIBUTES size") - -// GetFrom parses UNKNOWN-ATTRIBUTES from message. -func (a *UnknownAttributes) GetFrom(m *Message) error { - v, err := m.Get(AttrUnknownAttributes) - if err != nil { - return err - } - if len(v)%attrTypeSize != 0 { - return ErrBadUnknownAttrsSize - } - *a = (*a)[:0] - first := 0 - for first < len(v) { - last := first + attrTypeSize - *a = append(*a, - AttrType(bin.Uint16(v[first:last])), - ) - first = last - } - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/uri.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/uri.go deleted file mode 100644 index ebd2ef5..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/uri.go +++ /dev/null @@ -1,60 +0,0 @@ -package stun - -import ( - "errors" - "fmt" - "net/url" - "strconv" -) - -// Scheme definitions from RFC 7064 Section 3.2. -const ( - Scheme = "stun" - SchemeSecure = "stuns" -) - -// URI as defined in RFC 7064. -type URI struct { - Scheme string - Host string - Port int -} - -func (u URI) String() string { - if u.Port != 0 { - return fmt.Sprintf("%s:%s:%d", - u.Scheme, u.Host, u.Port, - ) - } - return u.Scheme + ":" + u.Host -} - -// ParseURI parses URI from string. -func ParseURI(rawURI string) (URI, error) { - // Carefully reusing URI parser from net/url. - u, urlParseErr := url.Parse(rawURI) - if urlParseErr != nil { - return URI{}, urlParseErr - } - if u.Scheme != Scheme && u.Scheme != SchemeSecure { - return URI{}, fmt.Errorf("unknown uri scheme %q", u.Scheme) - } - if u.Opaque == "" { - return URI{}, errors.New("invalid uri format: expected opaque") - } - // Using URL methods to split host. - u.Host = u.Opaque - host, rawPort := u.Hostname(), u.Port() - uri := URI{ - Scheme: u.Scheme, - Host: host, - } - if len(rawPort) > 0 { - port, portErr := strconv.Atoi(rawPort) - if portErr != nil { - return uri, fmt.Errorf("failed to parse %q as port: %v", rawPort, portErr) - } - uri.Port = port - } - return uri, nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/xor.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/xor.go deleted file mode 100644 index 34365eb..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/xor.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package stun - -import ( - "runtime" - "unsafe" -) - -// #nosec -const wordSize = int(unsafe.Sizeof(uintptr(0))) - -var supportsUnaligned = runtime.GOARCH == "386" || runtime.GOARCH == "amd64" - -// fastXORBytes xors in bulk. It only works on architectures that -// support unaligned read/writes. -// -// #nosec -func fastXORBytes(dst, a, b []byte) int { - n := len(a) - if len(b) < n { - n = len(b) - } - - w := n / wordSize - if w > 0 { - dw := *(*[]uintptr)(unsafe.Pointer(&dst)) - aw := *(*[]uintptr)(unsafe.Pointer(&a)) - bw := *(*[]uintptr)(unsafe.Pointer(&b)) - for i := 0; i < w; i++ { - dw[i] = aw[i] ^ bw[i] - } - } - - for i := n - n%wordSize; i < n; i++ { - dst[i] = a[i] ^ b[i] - } - - return n -} - -func safeXORBytes(dst, a, b []byte) int { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - dst[i] = a[i] ^ b[i] - } - return n -} - -// xorBytes xors the bytes in a and b. The destination is assumed to have enough -// space. Returns the number of bytes xor'd. -func xorBytes(dst, a, b []byte) int { - if supportsUnaligned { - return fastXORBytes(dst, a, b) - } - return safeXORBytes(dst, a, b) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/xoraddr.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/xoraddr.go deleted file mode 100644 index 23f7777..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/stun/xoraddr.go +++ /dev/null @@ -1,145 +0,0 @@ -package stun - -import ( - "errors" - "fmt" - "io" - "net" - "strconv" -) - -const ( - familyIPv4 uint16 = 0x01 - familyIPv6 uint16 = 0x02 -) - -// XORMappedAddress implements XOR-MAPPED-ADDRESS attribute. -// -// RFC 5389 Section 15.2 -type XORMappedAddress struct { - IP net.IP - Port int -} - -func (a XORMappedAddress) String() string { - return net.JoinHostPort(a.IP.String(), strconv.Itoa(a.Port)) -} - -// isIPv4 returns true if ip with len of net.IPv6Len seems to be ipv4. -func isIPv4(ip net.IP) bool { - // Optimized for performance. Copied from net.IP.To4. - return isZeros(ip[0:10]) && ip[10] == 0xff && ip[11] == 0xff -} - -// Is p all zeros? -func isZeros(p net.IP) bool { - for i := 0; i < len(p); i++ { - if p[i] != 0 { - return false - } - } - return true -} - -// ErrBadIPLength means that len(IP) is not net.{IPv6len,IPv4len}. -var ErrBadIPLength = errors.New("invalid length of IP value") - -// AddToAs adds XOR-MAPPED-ADDRESS value to m as t attribute. -func (a XORMappedAddress) AddToAs(m *Message, t AttrType) error { - var ( - family = familyIPv4 - ip = a.IP - ) - if len(a.IP) == net.IPv6len { - if isIPv4(ip) { - ip = ip[12:16] // like in ip.To4() - } else { - family = familyIPv6 - } - } else if len(ip) != net.IPv4len { - return ErrBadIPLength - } - value := make([]byte, 32+128) - value[0] = 0 // first 8 bits are zeroes - xorValue := make([]byte, net.IPv6len) - copy(xorValue[4:], m.TransactionID[:]) - bin.PutUint32(xorValue[0:4], magicCookie) - bin.PutUint16(value[0:2], family) - bin.PutUint16(value[2:4], uint16(a.Port^magicCookie>>16)) - xorBytes(value[4:4+len(ip)], ip, xorValue) - m.Add(t, value[:4+len(ip)]) - return nil -} - -// AddTo adds XOR-MAPPED-ADDRESS to m. Can return ErrBadIPLength -// if len(a.IP) is invalid. -func (a XORMappedAddress) AddTo(m *Message) error { - return a.AddToAs(m, AttrXORMappedAddress) -} - -// GetFromAs decodes XOR-MAPPED-ADDRESS attribute value in message -// getting it as for t type. -func (a *XORMappedAddress) GetFromAs(m *Message, t AttrType) error { - v, err := m.Get(t) - if err != nil { - return err - } - family := bin.Uint16(v[0:2]) - if family != familyIPv6 && family != familyIPv4 { - return newDecodeErr("xor-mapped address", "family", - fmt.Sprintf("bad value %d", family), - ) - } - ipLen := net.IPv4len - if family == familyIPv6 { - ipLen = net.IPv6len - } - // Ensuring len(a.IP) == ipLen and reusing a.IP. - if len(a.IP) < ipLen { - a.IP = a.IP[:cap(a.IP)] - for len(a.IP) < ipLen { - a.IP = append(a.IP, 0) - } - } - a.IP = a.IP[:ipLen] - for i := range a.IP { - a.IP[i] = 0 - } - if len(v) <= 4 { - return io.ErrUnexpectedEOF - } - if err := CheckOverflow(t, len(v[4:]), len(a.IP)); err != nil { - return err - } - a.Port = int(bin.Uint16(v[2:4])) ^ (magicCookie >> 16) - xorValue := make([]byte, 4+TransactionIDSize) - bin.PutUint32(xorValue[0:4], magicCookie) - copy(xorValue[4:], m.TransactionID[:]) - xorBytes(a.IP, v[4:], xorValue) - return nil -} - -// GetFrom decodes XOR-MAPPED-ADDRESS attribute in message and returns -// error if any. While decoding, a.IP is reused if possible and can be -// rendered to invalid state (e.g. if a.IP was set to IPv6 and then -// IPv4 value were decoded into it), be careful. -// -// Example: -// -// expectedIP := net.ParseIP("213.141.156.236") -// expectedIP.String() // 213.141.156.236, 16 bytes, first 12 of them are zeroes -// expectedPort := 21254 -// addr := &XORMappedAddress{ -// IP: expectedIP, -// Port: expectedPort, -// } -// // addr were added to message that is decoded as newMessage -// // ... -// -// addr.GetFrom(newMessage) -// addr.IP.String() // 213.141.156.236, net.IPv4Len -// expectedIP.String() // d58d:9cec::ffff:d58d:9cec, 16 bytes, first 4 are IPv4 -// // now we have len(expectedIP) = 16 and len(addr.IP) = 4. -func (a *XORMappedAddress) GetFrom(m *Message) error { - return a.GetFromAs(m, AttrXORMappedAddress) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.codecov.yml b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.codecov.yml deleted file mode 100644 index 05f120b..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.codecov.yml +++ /dev/null @@ -1,9 +0,0 @@ -coverage: - status: - patch: off - project: - default: - # basic - target: 75 - threshold: null - base: auto diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.gitignore b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.gitignore deleted file mode 100644 index 91b702a..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -cmd/turn-client/turn-client -*.zip - - -# go tests -*.test -*.out - -.idea diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.travis.yml b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.travis.yml deleted file mode 100644 index 1fd5ba4..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go - -sudo: false - -go: -- stable - -install: true - -script: - - ./go.test.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Gopkg.lock b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Gopkg.lock deleted file mode 100644 index 6722e22..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Gopkg.lock +++ /dev/null @@ -1,57 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:9eea710c689d8779906c7c8be68450fe547b2c035901277e4f806a7a0b8dad73" - name = "github.com/gortc/stun" - packages = [ - ".", - "internal/hmac", - ] - pruneopts = "UT" - revision = "382848e43da1af4a877b8e1c9374073168749f27" - version = "v1.17.2" - -[[projects]] - digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" - name = "go.uber.org/atomic" - packages = ["."] - pruneopts = "UT" - revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" - version = "v1.3.2" - -[[projects]] - digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a" - name = "go.uber.org/multierr" - packages = ["."] - pruneopts = "UT" - revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a" - version = "v1.1.0" - -[[projects]] - digest = "1:adccce69c151272d5053505aee552c6a1ac4e7bf6d18f0206ed7453187f6284d" - name = "go.uber.org/zap" - packages = [ - ".", - "buffer", - "internal/bufferpool", - "internal/color", - "internal/exit", - "zapcore", - "zaptest/observer", - ] - pruneopts = "UT" - revision = "ff33455a0e382e8a81d14dd7c922020b6b5e7982" - version = "v1.9.1" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/gortc/stun", - "go.uber.org/zap", - "go.uber.org/zap/zapcore", - "go.uber.org/zap/zaptest/observer", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Gopkg.toml b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Gopkg.toml deleted file mode 100644 index ef6e89f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Gopkg.toml +++ /dev/null @@ -1,34 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - - -[[constraint]] - name = "github.com/gortc/stun" - version = "1.17.2" - -[[constraint]] - name = "go.uber.org/zap" - version = "1.8.0" - -[prune] - go-tests = true - unused-packages = true diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/LICENSE b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/LICENSE deleted file mode 100644 index 7bb8afa..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2017-2018, gortc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Makefile b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Makefile deleted file mode 100644 index a2f4500..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -GO_VERSION=$(shell gobuild -v) -GO := $(or $(GOROOT),/usr/lib/go)/bin/go -PROCS := $(shell nproc) -cores: - @echo "cores: $(PROCS)" -test: - go test -v -bench: - go test -bench . -bench-record: - $(GO) test -bench . > "benchmarks/turn-go-$(GO_VERSION).txt" -fuzz-prepare-setters: - go-fuzz-build -func FuzzSetters -o turn-setters-fuzz.zip github.com/gortc/turn -fuzz-setters: - go-fuzz -bin=./turn-setters-fuzz.zip -workdir=fuzz/turn-setters -fuzz-test: - go test -tags gofuzz -run TestFuzz -v . -fuzz-prepare-chandata: - go-fuzz-build -func FuzzChannelData -o turn-chandata-fuzz.zip github.com/gortc/turn -fuzz-chandata: - go-fuzz -bin=./turn-chandata-fuzz.zip -workdir=fuzz/turn-chandata -lint: - @echo "linting on $(PROCS) cores" - @gometalinter \ - --enable-all \ - --vendor \ - -e "_test.go.+(gocyclo|errcheck|dupl)" \ - -e "attributes\.go.+credentials,.+,LOW.+\(gas\)" \ - -e "parameter v always receives 4" \ - -e "function \(\*Client\).allocate\(\) is high .+\(gocyclo\)" \ - --enable="lll" --line-length=100 \ - --enable="gofmt" \ - --enable="goimports" \ - --enable="misspell" \ - --enable="unused" \ - --deadline=300s \ - --disable="gochecknoglobals" \ - --disable="interfacer" \ - -j $(PROCS) - @echo "ok" -escape: - @echo "Not escapes, except autogenerated:" - @go build -gcflags '-m -l' 2>&1 \ - | grep -v "" \ - | grep escapes -format: - goimports -w . -docker-build: - docker build -t gortc/turn . -test-integration: - @cd e2e && ./test.sh -check-api: - api -c api/turn1.txt github.com/gortc/turn -write-api: - api github.com/gortc/turn > api/turn1.txt - diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/README.md b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/README.md deleted file mode 100644 index fe3c979..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/README.md +++ /dev/null @@ -1,47 +0,0 @@ -[![Build Status](https://travis-ci.com/gortc/turn.svg?branch=master)](https://travis-ci.com/gortc/turn) -[![Master status](https://tc.gortc.io/app/rest/builds/buildType:(id:stun_MasterStatus)/statusIcon.svg)](https://tc.gortc.io) -[![Build status](https://ci.appveyor.com/api/projects/status/bodd3l5hgu1agxpf/branch/master?svg=true)](https://ci.appveyor.com/project/ernado/turn-gvuk2/branch/master) -[![GoDoc](https://godoc.org/github.com/gortc/turn?status.svg)](http://godoc.org/github.com/gortc/turn) -[![codecov](https://codecov.io/gh/gortc/turn/branch/master/graph/badge.svg)](https://codecov.io/gh/gortc/turn) -[![Go Report](https://goreportcard.com/badge/github.com/gortc/turn)](http://goreportcard.com/report/gortc/turn) -[![stability-beta](https://img.shields.io/badge/stability-beta-33bbff.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#beta) - -# TURN - -Package turn implements TURN [[RFC 5766](https://tools.ietf.org/html/rfc5766)] Traversal Using Relays around NAT. -Complies to [gortc principles](https://gortc.io/#principles) as core package. -Based on [gortc/stun](https://github.com/gortc/stun) package. -See [gortcd](https://github.com/gortc/gortcd) for TURN server. - -## RFCs - -The package aims to implement the follwing RFCs. Note that the requirement status is based on the [WebRTC spec](https://tools.ietf.org/html/draft-ietf-rtcweb-overview), focusing on data channels for now. - -rfc | status | requirement | description -----|--------|-------------|---- -[![RFC5766](https://img.shields.io/badge/RFC-5766-blue.svg)](https://tools.ietf.org/html/rfc5766) | ![status](https://img.shields.io/badge/status-beta-green.svg) | [![status](https://img.shields.io/badge/requirement-MUST-green.svg)](https://tools.ietf.org/html/rfc2119) | Traversal Using Relays around NAT -[![RFC7065](https://img.shields.io/badge/RFC-7065-blue.svg)](https://tools.ietf.org/html/rfc7065) | ![status](https://img.shields.io/badge/status-beta-green.svg) | [![status](https://img.shields.io/badge/requirement-MUST-green.svg)](https://tools.ietf.org/html/rfc2119) | TURN URI -[![RFC6156](https://img.shields.io/badge/RFC-6156-blue.svg)](https://tools.ietf.org/html/rfc6156) | ![status](https://img.shields.io/badge/status-beta-green.svg) | [![status](https://img.shields.io/badge/requirement-MUST-green.svg)](https://tools.ietf.org/html/rfc2119) | TURN Extension for IPv6 -[(TLS-over-)TCP](https://tools.ietf.org/html/rfc5766#section-2.1) | ![status](https://img.shields.io/badge/status-research-orange.svg) | [![status](https://img.shields.io/badge/requirement-MUST-green.svg)](https://tools.ietf.org/html/rfc2119) | Sending over TCP or TLS-over-TCP - -## Benchmarks - - -``` -goos: linux -goarch: amd64 -pkg: github.com/gortc/turn -PASS -benchmark iter time/iter throughput bytes alloc allocs ---------- ---- --------- ---------- ----------- ------ -BenchmarkIsChannelData-12 2000000000 1.64 ns/op 6694.29 MB/s 0 B/op 0 allocs/op -BenchmarkChannelData_Encode-12 200000000 9.11 ns/op 1317.35 MB/s 0 B/op 0 allocs/op -BenchmarkChannelData_Decode-12 500000000 3.92 ns/op 3061.45 MB/s 0 B/op 0 allocs/op -BenchmarkChannelNumber/AddTo-12 100000000 12.60 ns/op 0 B/op 0 allocs/op -BenchmarkChannelNumber/GetFrom-12 200000000 7.23 ns/op 0 B/op 0 allocs/op -BenchmarkData/AddTo-12 100000000 18.80 ns/op 0 B/op 0 allocs/op -BenchmarkData/AddToRaw-12 100000000 16.80 ns/op 0 B/op 0 allocs/op -BenchmarkLifetime/AddTo-12 100000000 13.70 ns/op 0 B/op 0 allocs/op -BenchmarkLifetime/GetFrom-12 200000000 7.10 ns/op 0 B/op 0 allocs/op -ok github.com/gortc/turn 19.110s -``` \ No newline at end of file diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/addr.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/addr.go deleted file mode 100644 index 4849535..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/addr.go +++ /dev/null @@ -1,60 +0,0 @@ -package turn - -import ( - "fmt" - "net" -) - -// Addr is ip:port. -type Addr struct { - IP net.IP - Port int -} - -// Network implements net.Addr. -func (Addr) Network() string { return "turn" } - -// FromUDPAddr sets addr to UDPAddr. -func (a *Addr) FromUDPAddr(n *net.UDPAddr) { - a.IP = n.IP - a.Port = n.Port -} - -// Equal returns true if b == a. -func (a Addr) Equal(b Addr) bool { - if a.Port != b.Port { - return false - } - return a.IP.Equal(b.IP) -} - -func (a Addr) String() string { - return fmt.Sprintf("%s:%d", a.IP, a.Port) -} - -// FiveTuple represents 5-TUPLE value. -type FiveTuple struct { - Client Addr - Server Addr - Proto Protocol -} - -func (t FiveTuple) String() string { - return fmt.Sprintf("%s->%s (%s)", - t.Client, t.Server, t.Proto, - ) -} - -// Equal returns true if b == t. -func (t FiveTuple) Equal(b FiveTuple) bool { - if t.Proto != b.Proto { - return false - } - if !t.Client.Equal(b.Client) { - return false - } - if !t.Server.Equal(b.Server) { - return false - } - return true -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/appveyor.yml b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/appveyor.yml deleted file mode 100644 index fedbc39..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: "{build}" - -platform: x64 - -branches: - only: - - master - -skip_tags: true - -clone_folder: c:\gopath\src\github.com\gortc\turn - -environment: - GOPATH: c:\gopath - GOVERSION: 1.10 - -install: - - go version - -build_script: - - go test -v . diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/chandata.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/chandata.go deleted file mode 100644 index ecda579..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/chandata.go +++ /dev/null @@ -1,138 +0,0 @@ -package turn - -import ( - "bytes" - "errors" - "io" -) - -// ChannelData represents The ChannelData Message. -// -// See RFC 5766 Section 11.4 -type ChannelData struct { - Data []byte // can be subslice of Raw - Length int // ignored while encoding, len(Data) is used - Padding bool // use padding - Number ChannelNumber - Raw []byte -} - -// Equal returns true if b == c. -func (c *ChannelData) Equal(b *ChannelData) bool { - if c == nil && b == nil { - return true - } - if c == nil || b == nil { - return false - } - if c.Number != b.Number { - return false - } - if len(c.Data) != len(b.Data) { - return false - } - return bytes.Equal(c.Data, b.Data) -} - -// grow ensures that internal buffer will fit v more bytes and -// increases it capacity if necessary. -// -// Similar to stun.Message.grow method. -func (c *ChannelData) grow(v int) { - n := len(c.Raw) + v - for cap(c.Raw) < n { - c.Raw = append(c.Raw, 0) - } - c.Raw = c.Raw[:n] -} - -// Reset resets Length, Data and Raw length. -func (c *ChannelData) Reset() { - c.Raw = c.Raw[:0] - c.Length = 0 - c.Data = c.Data[:0] -} - -// Encode encodes ChannelData Message to Raw. -func (c *ChannelData) Encode() { - c.Raw = c.Raw[:0] - c.WriteHeader() - c.Raw = append(c.Raw, c.Data...) - if !c.Padding { - return - } - padded := nearestPaddedValueLength(len(c.Raw)) - if bytesToAdd := padded - len(c.Raw); bytesToAdd > 0 { - for i := 0; i < bytesToAdd; i++ { - c.Raw = append(c.Raw, 0) - } - } -} - -const padding = 4 - -func nearestPaddedValueLength(l int) int { - n := padding * (l / padding) - if n < l { - n += padding - } - return n -} - -// WriteHeader writes channel number and length. -func (c *ChannelData) WriteHeader() { - if len(c.Raw) < channelDataHeaderSize { - // Making WriteHeader call valid even when c.Raw - // is nil or len(c.Raw) is less than needed for header. - c.grow(channelDataHeaderSize) - } - // Early bounds check to guarantee safety of writes below. - _ = c.Raw[:channelDataHeaderSize] - bin.PutUint16(c.Raw[:channelDataNumberSize], uint16(c.Number)) - bin.PutUint16(c.Raw[channelDataNumberSize:channelDataHeaderSize], - uint16(len(c.Data)), - ) -} - -// ErrBadChannelDataLength means that channel data length is not equal -// to actual data length. -var ErrBadChannelDataLength = errors.New("channelData length != len(Data)") - -// Decode decodes The ChannelData Message from Raw. -func (c *ChannelData) Decode() error { - buf := c.Raw - if len(buf) < channelDataHeaderSize { - return io.ErrUnexpectedEOF - } - num := bin.Uint16(buf[:channelDataNumberSize]) - c.Number = ChannelNumber(num) - l := bin.Uint16(buf[channelDataNumberSize:channelDataHeaderSize]) - c.Data = buf[channelDataHeaderSize:] - c.Length = int(l) - if !c.Number.Valid() { - return ErrInvalidChannelNumber - } - if int(l) < len(c.Data) { - c.Data = c.Data[:int(l)] - } - if int(l) > len(buf[channelDataHeaderSize:]) { - return ErrBadChannelDataLength - } - return nil -} - -const ( - channelDataLengthSize = 2 - channelDataNumberSize = channelDataLengthSize - channelDataHeaderSize = channelDataLengthSize + channelDataNumberSize -) - -// IsChannelData returns true if buf looks like the ChannelData Message. -func IsChannelData(buf []byte) bool { - if len(buf) < channelDataHeaderSize { - return false - } - // Quick check for channel number. - num := bin.Uint16(buf[0:channelNumberSize]) - return isChannelNumberValid(num) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/chann.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/chann.go deleted file mode 100644 index 5332ba6..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/chann.go +++ /dev/null @@ -1,66 +0,0 @@ -package turn - -import ( - "errors" - "strconv" - - "github.com/gortc/stun" -) - -// ChannelNumber represents CHANNEL-NUMBER attribute. -// -// The CHANNEL-NUMBER attribute contains the number of the channel. -// -// RFC 5766 Section 14.1 -type ChannelNumber int // encoded as uint16 - -func (n ChannelNumber) String() string { return strconv.Itoa(int(n)) } - -// 16 bits of uint + 16 bits of RFFU = 0. -const channelNumberSize = 4 - -// AddTo adds CHANNEL-NUMBER to message. -func (n ChannelNumber) AddTo(m *stun.Message) error { - v := make([]byte, channelNumberSize) - bin.PutUint16(v[:2], uint16(n)) - // v[2:4] are zeroes (RFFU = 0) - m.Add(stun.AttrChannelNumber, v) - return nil -} - -// GetFrom decodes CHANNEL-NUMBER from message. -func (n *ChannelNumber) GetFrom(m *stun.Message) error { - v, err := m.Get(stun.AttrChannelNumber) - if err != nil { - return err - } - if err = stun.CheckSize(stun.AttrChannelNumber, len(v), channelNumberSize); err != nil { - return err - } - _ = v[channelNumberSize-1] // asserting length - *n = ChannelNumber(bin.Uint16(v[:2])) - // v[2:4] is RFFU and equals to 0. - return nil -} - -// See https://tools.ietf.org/html/rfc5766#section-11: -// -// 0x4000 through 0x7FFF: These values are the allowed channel -// numbers (16,383 possible values). -const ( - minChannelNumber = 0x4000 - maxChannelNumber = 0x7FFF -) - -// ErrInvalidChannelNumber means that channel number is not valid as by RFC 5766 Section 11. -var ErrInvalidChannelNumber = errors.New("channel number not in [0x4000, 0x7FFF]") - -// isChannelNumberValid returns true if c in [0x4000, 0x7FFF]. -func isChannelNumberValid(c uint16) bool { - return c >= minChannelNumber && c <= maxChannelNumber -} - -// Valid returns true if channel number has correct value that complies RFC 5766 Section 11 range. -func (n ChannelNumber) Valid() bool { - return isChannelNumberValid(uint16(n)) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/client.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/client.go deleted file mode 100644 index 614561f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/client.go +++ /dev/null @@ -1,506 +0,0 @@ -package turn - -import ( - "errors" - "fmt" - "io" - "net" - "sync" - "time" - - "go.uber.org/zap" - - "github.com/gortc/stun" -) - -// Allocation reflects TURN Allocation. -type Allocation struct { - log *zap.Logger - client *Client - relayed RelayedAddress - reflexive stun.XORMappedAddress - perms []*Permission - minBound ChannelNumber - integrity stun.MessageIntegrity - nonce stun.Nonce -} - -// Client for TURN server. -// -// Provides transparent net.Conn interfaces to remote peers. -type Client struct { - log *zap.Logger - con net.Conn - stun STUNClient - mux sync.Mutex - username stun.Username - password string - realm stun.Realm - integrity stun.MessageIntegrity - alloc *Allocation // the only allocation -} - -// ClientOptions contains available config for TURN client. -type ClientOptions struct { - Conn net.Conn - STUN STUNClient // optional STUN client - Log *zap.Logger // defaults to Nop - - // Long-term integrity. - Username string - Password string - - // STUN client options. - RTO time.Duration - NoRetransmit bool -} - -// NewClient creates and initializes new TURN client. -func NewClient(o ClientOptions) (*Client, error) { - if o.Conn == nil { - return nil, errors.New("connection not provided") - } - if o.Log == nil { - o.Log = zap.NewNop() - } - c := &Client{ - password: o.Password, - log: o.Log, - } - if o.STUN == nil { - // Setting up de-multiplexing. - m := newMultiplexer(o.Conn, c.log.Named("multiplexer")) - go m.discardData() // discarding any non-stun/turn data - o.Conn = bypassWriter{ - reader: m.turnL, - writer: m.conn, - } - // Starting STUN client on multiplexed connection. - var err error - stunOptions := []stun.ClientOption{ - stun.WithHandler(c.stunHandler), - } - if o.NoRetransmit { - stunOptions = append(stunOptions, stun.WithNoRetransmit) - } - if o.RTO > 0 { - stunOptions = append(stunOptions, stun.WithRTO(o.RTO)) - } - o.STUN, err = stun.NewClient(bypassWriter{ - reader: m.stunL, - writer: m.conn, - }, stunOptions...) - if err != nil { - return nil, err - } - } - c.stun = o.STUN - c.con = o.Conn - - if o.Username != "" { - c.username = stun.NewUsername(o.Username) - } - go c.readUntilClosed() - return c, nil -} - -// STUNClient abstracts STUN protocol interaction. -type STUNClient interface { - Indicate(m *stun.Message) error - Do(m *stun.Message, f func(e stun.Event)) error -} - -func (c *Client) stunHandler(e stun.Event) { - if e.Error != nil { - // Just ignoring. - return - } - if e.Message.Type != stun.NewType(stun.MethodData, stun.ClassIndication) { - return - } - var ( - data Data - addr PeerAddress - ) - if err := e.Message.Parse(&data, &addr); err != nil { - c.log.Error("failed to parse while handling incoming STUN message", zap.Error(err)) - return - } - c.mux.Lock() - for i := range c.alloc.perms { - if !Addr(c.alloc.perms[i].peerAddr).Equal(Addr(addr)) { - continue - } - if _, err := c.alloc.perms[i].peerL.Write(data); err != nil { - c.log.Error("failed to write", zap.Error(err)) - } - } - c.mux.Unlock() -} - -// ZapChannelNumber returns zap.Field for ChannelNumber. -func ZapChannelNumber(key string, v ChannelNumber) zap.Field { - return zap.String(key, fmt.Sprintf("0x%x", int(v))) -} - -func (c *Client) handleChannelData(data *ChannelData) { - c.log.Debug("handleChannelData", ZapChannelNumber("number", data.Number)) - c.mux.Lock() - for i := range c.alloc.perms { - if data.Number != c.alloc.perms[i].Binding() { - continue - } - if _, err := c.alloc.perms[i].peerL.Write(data.Data); err != nil { - c.log.Error("failed to write", zap.Error(err)) - } - } - c.mux.Unlock() -} - -func (c *Client) readUntilClosed() { - buf := make([]byte, 1500) - for { - n, err := c.con.Read(buf) - if err != nil { - if err == io.EOF { - continue - } - c.log.Error("read failed", zap.Error(err)) - break - } - data := buf[:n] - if !IsChannelData(data) { - continue - } - cData := &ChannelData{ - Raw: make([]byte, n), - } - copy(cData.Raw, data) - if err := cData.Decode(); err != nil { - panic(err) - } - go c.handleChannelData(cData) - } -} - -func (c *Client) sendData(buf []byte, peerAddr *PeerAddress) (int, error) { - err := c.stun.Indicate(stun.MustBuild(stun.TransactionID, - stun.NewType(stun.MethodSend, stun.ClassIndication), - Data(buf), peerAddr, - )) - if err == nil { - return len(buf), nil - } - return 0, err -} - -func (c *Client) sendChan(buf []byte, n ChannelNumber) (int, error) { - if !n.Valid() { - return 0, ErrInvalidChannelNumber - } - d := &ChannelData{ - Data: buf, - Number: n, - } - d.Encode() - return c.con.Write(d.Raw) -} - -// ErrNotImplemented means that functionality is not currently implemented, -// but it will be (eventually). -var ErrNotImplemented = errors.New("functionality not implemented") - -var errUnauthorised = errors.New("unauthorised") - -func (c *Client) do(req, res *stun.Message) error { - var stunErr error - if doErr := c.stun.Do(req, func(e stun.Event) { - if e.Error != nil { - stunErr = e.Error - return - } - if res == nil { - return - } - if err := e.Message.CloneTo(res); err != nil { - stunErr = err - } - }); doErr != nil { - return doErr - } - return stunErr -} - -// allocate expects client.mux locked. -func (c *Client) allocate(req, res *stun.Message) (*Allocation, error) { - if doErr := c.do(req, res); doErr != nil { - return nil, doErr - } - if res.Type == stun.NewType(stun.MethodAllocate, stun.ClassSuccessResponse) { - var ( - relayed RelayedAddress - reflexive stun.XORMappedAddress - nonce stun.Nonce - ) - // Getting relayed and reflexive addresses from response. - if err := relayed.GetFrom(res); err != nil { - return nil, err - } - if err := reflexive.GetFrom(res); err != nil && err != stun.ErrAttributeNotFound { - return nil, err - } - // Getting nonce from request. - if err := nonce.GetFrom(req); err != nil && err != stun.ErrAttributeNotFound { - return nil, err - } - a := &Allocation{ - client: c, - log: c.log.Named("allocation"), - reflexive: reflexive, - relayed: relayed, - minBound: minChannelNumber, - integrity: c.integrity, - nonce: nonce, - } - c.alloc = a - return a, nil - } - // Anonymous allocate failed, trying to authenticate. - if res.Type.Method != stun.MethodAllocate { - return nil, fmt.Errorf("unexpected response type %s", res.Type) - } - var ( - code stun.ErrorCodeAttribute - ) - if err := code.GetFrom(res); err != nil { - return nil, err - } - if code.Code != stun.CodeUnauthorised { - return nil, fmt.Errorf("unexpected error code %d", code) - } - return nil, errUnauthorised -} - -// Allocate creates an allocation for current 5-tuple. Currently there can be -// only one allocation per client, because client wraps one net.Conn. -func (c *Client) Allocate() (*Allocation, error) { - var ( - nonce stun.Nonce - res = stun.New() - ) - req, reqErr := stun.Build(stun.TransactionID, - AllocateRequest, RequestedTransportUDP, - stun.Fingerprint, - ) - if reqErr != nil { - return nil, reqErr - } - a, allocErr := c.allocate(req, res) - if allocErr == nil { - return a, nil - } - if allocErr != errUnauthorised { - return nil, allocErr - } - // Anonymous allocate failed, trying to authenticate. - if err := nonce.GetFrom(res); err != nil { - return nil, err - } - if err := c.realm.GetFrom(res); err != nil { - return nil, err - } - c.integrity = stun.NewLongTermIntegrity( - c.username.String(), c.realm.String(), c.password, - ) - // Trying to authorise. - if reqErr = req.Build(stun.TransactionID, - AllocateRequest, RequestedTransportUDP, - &c.username, &c.realm, - &nonce, - &c.integrity, stun.Fingerprint, - ); reqErr != nil { - return nil, reqErr - } - return c.allocate(req, res) -} - -// Create creates new permission to peer -func (a *Allocation) Create(peer net.Addr) (*Permission, error) { - switch addr := peer.(type) { - case *net.UDPAddr: - return a.CreateUDP(addr) - default: - return nil, fmt.Errorf("unsupported addr type %T", peer) - } -} - -// CreateUDP creates new UDP Permission to peer with provided addr. -func (a *Allocation) CreateUDP(addr *net.UDPAddr) (*Permission, error) { - req := stun.New() - req.TransactionID = stun.NewTransactionID() - req.Type = stun.NewType(stun.MethodCreatePermission, stun.ClassRequest) - req.WriteHeader() - setters := make([]stun.Setter, 0, 10) - peer := PeerAddress{ - IP: addr.IP, - Port: addr.Port, - } - setters = append(setters, &peer) - if len(a.integrity) > 0 { - // Applying auth. - setters = append(setters, - a.nonce, a.client.username, a.client.realm, a.integrity, - ) - } - setters = append(setters, stun.Fingerprint) - for _, s := range setters { - if setErr := s.AddTo(req); setErr != nil { - return nil, setErr - } - } - res := stun.New() - if doErr := a.client.do(req, res); doErr != nil { - return nil, doErr - } - if res.Type.Class == stun.ClassErrorResponse { - var code stun.ErrorCodeAttribute - err := fmt.Errorf("unexpected error response: %s", res.Type) - if getErr := code.GetFrom(res); getErr == nil { - err = fmt.Errorf("unexpected error response: %s (error %s)", - res.Type, code, - ) - } - return nil, err - } - p := &Permission{ - log: a.log.Named("permission"), - peerAddr: peer, - client: a.client, - } - p.peerL, p.peerR = net.Pipe() - a.perms = append(a.perms, p) - return p, nil -} - -// Permission implements net.PacketConn. -type Permission struct { - log *zap.Logger - mux sync.RWMutex - number ChannelNumber - peerAddr PeerAddress - peerL, peerR net.Conn - client *Client -} - -// Read data from peer. -func (p *Permission) Read(b []byte) (n int, err error) { - return p.peerR.Read(b) -} - -// Bound returns true if channel number is bound for current permission. -func (p *Permission) Bound() bool { - p.mux.RLock() - defer p.mux.RUnlock() - return p.number.Valid() -} - -// Binding returns current channel number or 0 if not bound. -func (p *Permission) Binding() ChannelNumber { - p.mux.RLock() - defer p.mux.RUnlock() - return p.number -} - -// ErrAlreadyBound means that selected permission already has bound channel number. -var ErrAlreadyBound = errors.New("channel already bound") - -// Bind performs binding transaction, allocating channel binding for -// the permission. -// -// TODO: Start binding refresh cycle -func (p *Permission) Bind() error { - p.mux.Lock() - defer p.mux.Unlock() - if p.number != 0 { - return ErrAlreadyBound - } - a := p.client.alloc - a.minBound++ - n := a.minBound - - // Starting transaction. - res := stun.New() - req := stun.New() - req.TransactionID = stun.NewTransactionID() - req.Type = stun.NewType(stun.MethodChannelBind, stun.ClassRequest) - req.WriteHeader() - setters := make([]stun.Setter, 0, 10) - setters = append(setters, &p.peerAddr, n) - if len(a.integrity) > 0 { - // Applying auth. - setters = append(setters, - a.nonce, a.client.username, a.client.realm, a.integrity, - ) - } - setters = append(setters, stun.Fingerprint) - for _, s := range setters { - if setErr := s.AddTo(req); setErr != nil { - return setErr - } - } - if doErr := p.client.do(req, res); doErr != nil { - return doErr - } - if res.Type != stun.NewType(stun.MethodChannelBind, stun.ClassSuccessResponse) { - return fmt.Errorf("unexpected response type %s", res.Type) - } - // Success. - p.number = n - return nil -} - -// Write sends buffer to peer. -// -// If permission is bound, the ChannelData message will be used. -func (p *Permission) Write(b []byte) (n int, err error) { - if n := p.Binding(); n.Valid() { - if ce := p.log.Check(zap.DebugLevel, "using channel data to write"); ce != nil { - ce.Write() - } - return p.client.sendChan(b, n) - } - if ce := p.log.Check(zap.DebugLevel, "using STUN to write"); ce != nil { - ce.Write() - } - return p.client.sendData(b, &p.peerAddr) -} - -// Close implements net.Conn. -func (p *Permission) Close() error { - return p.peerR.Close() -} - -// LocalAddr is relayed address from TURN server. -func (p *Permission) LocalAddr() net.Addr { - return Addr(p.client.alloc.relayed) -} - -// RemoteAddr is peer address. -func (p *Permission) RemoteAddr() net.Addr { - return Addr(p.peerAddr) -} - -// SetDeadline implements net.Conn. -func (p *Permission) SetDeadline(t time.Time) error { - return p.peerR.SetDeadline(t) -} - -// SetReadDeadline implements net.Conn. -func (p *Permission) SetReadDeadline(t time.Time) error { - return p.peerR.SetReadDeadline(t) -} - -// SetWriteDeadline implements net.Conn. -func (p *Permission) SetWriteDeadline(t time.Time) error { - return ErrNotImplemented -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/data.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/data.go deleted file mode 100644 index 0a452c7..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/data.go +++ /dev/null @@ -1,30 +0,0 @@ -package turn - -import "github.com/gortc/stun" - -// Data represents DATA attribute. -// -// The DATA attribute is present in all Send and Data indications. The -// value portion of this attribute is variable length and consists of -// the application data (that is, the data that would immediately follow -// the UDP header if the data was been sent directly between the client -// and the peer). -// -// RFC 5766 Section 14.4 -type Data []byte - -// AddTo adds DATA to message. -func (d Data) AddTo(m *stun.Message) error { - m.Add(stun.AttrData, d) - return nil -} - -// GetFrom decodes DATA from message. -func (d *Data) GetFrom(m *stun.Message) error { - v, err := m.Get(stun.AttrData) - if err != nil { - return err - } - *d = v - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/dontfrag.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/dontfrag.go deleted file mode 100644 index a9597af..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/dontfrag.go +++ /dev/null @@ -1,21 +0,0 @@ -package turn - -import "github.com/gortc/stun" - -// DontFragmentAttr represents DONT-FRAGMENT attribute. -type DontFragmentAttr struct{} - -// AddTo adds DONT-FRAGMENT attribute to message. -func (DontFragmentAttr) AddTo(m *stun.Message) error { - m.Add(stun.AttrDontFragment, nil) - return nil -} - -// IsSet returns true if DONT-FRAGMENT attribute is set. -func (DontFragmentAttr) IsSet(m *stun.Message) bool { - _, err := m.Get(stun.AttrDontFragment) - return err == nil -} - -// DontFragment is shorthand for DontFragmentAttr. -var DontFragment DontFragmentAttr diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/evenport.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/evenport.go deleted file mode 100644 index 5e152f7..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/evenport.go +++ /dev/null @@ -1,55 +0,0 @@ -package turn - -import "github.com/gortc/stun" - -// EvenPort represents EVEN-PORT attribute. -// -// This attribute allows the client to request that the port in the -// relayed transport address be even, and (optionally) that the server -// reserve the next-higher port number. -// -// RFC 5766 Section 14.6 -type EvenPort struct { - // ReservePort means that the server is requested to reserve - // the next-higher port number (on the same IP address) - // for a subsequent allocation. - ReservePort bool -} - -func (p EvenPort) String() string { - if p.ReservePort { - return "reserve: true" - } - return "reserve: false" -} - -const ( - evenPortSize = 1 - firstBitSet = (1 << 8) - 1 // 0b100000000 -) - -// AddTo adds EVEN-PORT to message. -func (p EvenPort) AddTo(m *stun.Message) error { - v := make([]byte, evenPortSize) - if p.ReservePort { - // Set first bit to 1. - v[0] = firstBitSet - } - m.Add(stun.AttrEvenPort, v) - return nil -} - -// GetFrom decodes EVEN-PORT from message. -func (p *EvenPort) GetFrom(m *stun.Message) error { - v, err := m.Get(stun.AttrEvenPort) - if err != nil { - return err - } - if err = stun.CheckSize(stun.AttrEvenPort, len(v), evenPortSize); err != nil { - return err - } - if v[0]&firstBitSet > 0 { - p.ReservePort = true - } - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/fuzz.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/fuzz.go deleted file mode 100644 index 46bc2bb..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/fuzz.go +++ /dev/null @@ -1,111 +0,0 @@ -// +build gofuzz - -package turn - -import ( - "fmt" - - "github.com/gortc/stun" -) - -type attr interface { - stun.Getter - stun.Setter -} - -type attrs []struct { - g attr - t stun.AttrType -} - -func (a attrs) pick(v byte) struct { - g attr - t stun.AttrType -} { - idx := int(v) % len(a) - return a[idx] -} - -func FuzzSetters(data []byte) int { - var ( - m1 = &stun.Message{ - Raw: make([]byte, 0, 2048), - } - m2 = &stun.Message{ - Raw: make([]byte, 0, 2048), - } - m3 = &stun.Message{ - Raw: make([]byte, 0, 2048), - } - ) - attributes := attrs{ - {new(RequestedTransport), stun.AttrRequestedTransport}, - {new(RelayedAddress), stun.AttrXORRelayedAddress}, - {new(ChannelNumber), stun.AttrChannelNumber}, - {new(Data), stun.AttrData}, - {new(EvenPort), stun.AttrEvenPort}, - {new(Lifetime), stun.AttrLifetime}, - {new(ReservationToken), stun.AttrReservationToken}, - } - var firstByte = byte(0) - if len(data) > 0 { - firstByte = data[0] - } - a := attributes.pick(firstByte) - value := data - if len(data) > 1 { - value = value[1:] - } - m1.WriteHeader() - m1.Add(a.t, value) - err := a.g.GetFrom(m1) - if err == stun.ErrAttributeNotFound { - fmt.Println("unexpected 404") - panic(err) - } - if err != nil { - return 1 - } - m2.WriteHeader() - if err := a.g.AddTo(m2); err != nil { - fmt.Println("failed to add attribute to m2") - panic(err) - } - m3.WriteHeader() - v, err := m2.Get(a.t) - if err != nil { - panic(err) - } - m3.Add(a.t, v) - - if !m2.Equal(m3) { - fmt.Println(m2, "not equal", m3) - panic("not equal") - } - return 1 -} - -var d = &ChannelData{} - -func FuzzChannelData(data []byte) int { - d.Reset() - if b := bin.Uint16(data[0:4]); b > 20000 { - bin.PutUint16(data[0:4], minChannelNumber-1) - } else if b > 40000 { - bin.PutUint16(data[0:4], minChannelNumber+(maxChannelNumber-minChannelNumber)%b) - } - d.Raw = append(d.Raw, data...) - if d.Decode() != nil { - return 0 - } - d2 := &ChannelData{} - d.Encode() - if !d.Number.Valid() { - return 1 - } - d2.Raw = d.Raw - if err := d2.Decode(); err != nil { - panic(err) - } - return 1 -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/go.test.sh b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/go.test.sh deleted file mode 100755 index 1f31127..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/go.test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -e -touch coverage.txt - -# test fuzz inputs -go test -tags gofuzz -run TestFuzz -v . - -# quick-test without -race -go test ./... - -# quick-test with "debug" -go test -tags debug ./... - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/lifetime.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/lifetime.go deleted file mode 100644 index 2439ead..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/lifetime.go +++ /dev/null @@ -1,55 +0,0 @@ -package turn - -import ( - "time" - - "github.com/gortc/stun" -) - -// DefaultLifetime in RFC 5766 is 10 minutes. -// -// RFC 5766 Section 2.2 -const DefaultLifetime = time.Minute * 10 - -// Lifetime represents LIFETIME attribute. -// -// The LIFETIME attribute represents the duration for which the server -// will maintain an allocation in the absence of a refresh. The value -// portion of this attribute is 4-bytes long and consists of a 32-bit -// unsigned integral value representing the number of seconds remaining -// until expiration. -// -// RFC 5766 Section 14.2 -type Lifetime struct { - time.Duration -} - -// uint32 seconds -const lifetimeSize = 4 // 4 bytes, 32 bits - -// AddTo adds LIFETIME to message. -func (l Lifetime) AddTo(m *stun.Message) error { - v := make([]byte, lifetimeSize) - bin.PutUint32(v, uint32(l.Seconds())) - m.Add(stun.AttrLifetime, v) - return nil -} - -// GetFrom decodes LIFETIME from message. -func (l *Lifetime) GetFrom(m *stun.Message) error { - v, err := m.Get(stun.AttrLifetime) - if err != nil { - return err - } - if err = stun.CheckSize(stun.AttrLifetime, len(v), lifetimeSize); err != nil { - return err - } - _ = v[lifetimeSize-1] // asserting length - seconds := bin.Uint32(v) - l.Duration = time.Second * time.Duration(seconds) - return nil -} - -// ZeroLifetime is shorthand for setting zero lifetime -// that indicates to close allocation. -var ZeroLifetime stun.Setter = Lifetime{} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/multiplexer.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/multiplexer.go deleted file mode 100644 index b7011cc..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/multiplexer.go +++ /dev/null @@ -1,144 +0,0 @@ -package turn - -import ( - "fmt" - "io" - "io/ioutil" - "net" - "time" - - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - - "github.com/gortc/stun" -) - -// multiplexer de-multiplexes STUN, TURN and application data -// from one connection into separate ones. -type multiplexer struct { - log *zap.Logger - capacity int - conn net.Conn - - stunL, stunR net.Conn - turnL, turnR net.Conn - dataL, dataR net.Conn -} - -type bypassWriter struct { - reader net.Conn - writer net.Conn -} - -func (w bypassWriter) Close() error { - rErr := w.reader.Close() - wErr := w.writer.Close() - if rErr == nil && wErr == nil { - return nil - } - return fmt.Errorf("reader: %v, writer: %v", rErr, wErr) -} - -func (w bypassWriter) LocalAddr() net.Addr { - return w.writer.LocalAddr() -} - -func (w bypassWriter) Read(b []byte) (n int, err error) { - return w.reader.Read(b) -} - -func (w bypassWriter) RemoteAddr() net.Addr { - return w.writer.RemoteAddr() -} - -func (w bypassWriter) SetDeadline(t time.Time) error { - if err := w.writer.SetDeadline(t); err != nil { - return err - } - return w.reader.SetDeadline(t) -} - -func (w bypassWriter) SetReadDeadline(t time.Time) error { - return w.reader.SetReadDeadline(t) -} - -func (w bypassWriter) SetWriteDeadline(t time.Time) error { - return w.writer.SetWriteDeadline(t) -} - -func (w bypassWriter) Write(b []byte) (n int, err error) { - return w.writer.Write(b) -} - -func newMultiplexer(conn net.Conn, log *zap.Logger) *multiplexer { - m := &multiplexer{conn: conn, capacity: 1500, log: log} - m.stunL, m.stunR = net.Pipe() - m.turnL, m.turnR = net.Pipe() - m.dataL, m.dataR = net.Pipe() - go m.readUntilClosed() - return m -} - -func (m *multiplexer) discardData() { - _, err := io.Copy(ioutil.Discard, m.dataL) - if err != nil { - m.log.Error("discard error", zap.Error(err)) - } -} - -func (m *multiplexer) close() { - if closeErr := m.turnR.Close(); closeErr != nil { - m.log.Error("failed to close turnR", zap.Error(closeErr)) - } - if closeErr := m.stunR.Close(); closeErr != nil { - m.log.Error("failed to close stunR", zap.Error(closeErr)) - } - if closeErr := m.dataR.Close(); closeErr != nil { - m.log.Error("failed to close dataR", zap.Error(closeErr)) - } -} - -func stunLog(ce *zapcore.CheckedEntry, data []byte) { - m := &stun.Message{ - Raw: data, - } - if err := m.Decode(); err == nil { - ce.Write(zap.Stringer("msg", m)) - } -} - -func (m *multiplexer) readUntilClosed() { - buf := make([]byte, m.capacity) - for { - n, err := m.conn.Read(buf) - if ce := m.log.Check(zap.DebugLevel, "read"); ce != nil { - ce.Write(zap.Error(err), zap.Int("n", n)) - } - if err != nil { - // End of cycle. - // TODO: Handle timeouts and temporary errors. - m.log.Error("failed to read", zap.Error(err)) - m.close() - break - } - data := buf[:n] - conn := m.dataR - switch { - case stun.IsMessage(data): - m.log.Debug("got STUN data") - if ce := m.log.Check(zap.DebugLevel, "stun message"); ce != nil { - stunLog(ce, data) - } - conn = m.stunR - case IsChannelData(data): - m.log.Debug("got TURN data") - conn = m.turnR - default: - m.log.Debug("got APP data") - } - _, err = conn.Write(data) - if err != nil { - m.log.Warn("failed to write", zap.Error(err)) - } - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/peeraddr.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/peeraddr.go deleted file mode 100644 index 002df04..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/peeraddr.go +++ /dev/null @@ -1,33 +0,0 @@ -package turn - -import ( - "net" - - "github.com/gortc/stun" -) - -// PeerAddress implements XOR-PEER-ADDRESS attribute. -// -// The XOR-PEER-ADDRESS specifies the address and port of the peer as -// seen from the TURN server. (For example, the peer's server-reflexive -// transport address if the peer is behind a NAT.) -// -// RFC 5766 Section 14.3 -type PeerAddress struct { - IP net.IP - Port int -} - -func (a PeerAddress) String() string { - return stun.XORMappedAddress(a).String() -} - -// AddTo adds XOR-PEER-ADDRESS to message. -func (a PeerAddress) AddTo(m *stun.Message) error { - return stun.XORMappedAddress(a).AddToAs(m, stun.AttrXORPeerAddress) -} - -// GetFrom decodes XOR-PEER-ADDRESS from message. -func (a *PeerAddress) GetFrom(m *stun.Message) error { - return (*stun.XORMappedAddress)(a).GetFromAs(m, stun.AttrXORPeerAddress) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/relayedaddr.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/relayedaddr.go deleted file mode 100644 index 8fd0477..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/relayedaddr.go +++ /dev/null @@ -1,33 +0,0 @@ -package turn - -import ( - "net" - - "github.com/gortc/stun" -) - -// RelayedAddress implements XOR-RELAYED-ADDRESS attribute. -// -// The XOR-PEER-ADDRESS specifies the address and port of the peer as -// seen from the TURN server. (For example, the peer's server-reflexive -// transport address if the peer is behind a NAT.) -// -// RFC 5766 Section 14.5 -type RelayedAddress struct { - IP net.IP - Port int -} - -func (a RelayedAddress) String() string { - return stun.XORMappedAddress(a).String() -} - -// AddTo adds XOR-PEER-ADDRESS to message. -func (a RelayedAddress) AddTo(m *stun.Message) error { - return stun.XORMappedAddress(a).AddToAs(m, stun.AttrXORRelayedAddress) -} - -// GetFrom decodes XOR-PEER-ADDRESS from message. -func (a *RelayedAddress) GetFrom(m *stun.Message) error { - return (*stun.XORMappedAddress)(a).GetFromAs(m, stun.AttrXORRelayedAddress) -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/reqfamily.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/reqfamily.go deleted file mode 100644 index 750f7f4..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/reqfamily.go +++ /dev/null @@ -1,59 +0,0 @@ -package turn - -import ( - "errors" - - "github.com/gortc/stun" -) - -// RequestedAddressFamily represents the REQUESTED-ADDRESS-FAMILY Attribute as -// defined in RFC 6156 Section 4.1.1. -type RequestedAddressFamily byte - -const requestedFamilySize = 4 - -// GetFrom decodes REQUESTED-ADDRESS-FAMILY from message. -func (f *RequestedAddressFamily) GetFrom(m *stun.Message) error { - v, err := m.Get(stun.AttrRequestedAddressFamily) - if err != nil { - return err - } - if err = stun.CheckSize(stun.AttrRequestedAddressFamily, len(v), requestedFamilySize); err != nil { - return err - } - switch v[0] { - case byte(RequestedFamilyIPv4), byte(RequestedFamilyIPv6): - *f = RequestedAddressFamily(v[0]) - default: - return errors.New("invalid value for requested family attribute") - } - return nil -} - -func (f RequestedAddressFamily) String() string { - switch f { - case RequestedFamilyIPv4: - return "IPv4" - case RequestedFamilyIPv6: - return "IPv6" - default: - return "unknown" - } -} - -// AddTo adds REQUESTED-ADDRESS-FAMILY to message. -func (f RequestedAddressFamily) AddTo(m *stun.Message) error { - v := make([]byte, requestedFamilySize) - v[0] = byte(f) - // b[1:4] is RFFU = 0. - // The RFFU field MUST be set to zero on transmission and MUST be - // ignored on reception. It is reserved for future uses. - m.Add(stun.AttrRequestedAddressFamily, v) - return nil -} - -// Values for RequestedAddressFamily as defined in RFC 6156 Section 4.1.1. -const ( - RequestedFamilyIPv4 RequestedAddressFamily = 0x01 - RequestedFamilyIPv6 RequestedAddressFamily = 0x02 -) diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/reqtrans.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/reqtrans.go deleted file mode 100644 index 7b8a2a9..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/reqtrans.go +++ /dev/null @@ -1,71 +0,0 @@ -package turn - -import ( - "strconv" - - "github.com/gortc/stun" -) - -// Protocol is IANA assigned protocol number. -type Protocol byte - -const ( - // ProtoUDP is IANA assigned protocol number for UDP. - ProtoUDP Protocol = 17 -) - -func (p Protocol) String() string { - switch p { - case ProtoUDP: - return "UDP" - default: - return strconv.Itoa(int(p)) - } -} - -// RequestedTransport represents REQUESTED-TRANSPORT attribute. -// -// This attribute is used by the client to request a specific transport -// protocol for the allocated transport address. RFC 5766 only allows the use of -// codepoint 17 (User Datagram Protocol). -// -// RFC 5766 Section 14.7 -type RequestedTransport struct { - Protocol Protocol -} - -func (t RequestedTransport) String() string { - return "protocol: " + t.Protocol.String() -} - -const requestedTransportSize = 4 - -// AddTo adds REQUESTED-TRANSPORT to message. -func (t RequestedTransport) AddTo(m *stun.Message) error { - v := make([]byte, requestedTransportSize) - v[0] = byte(t.Protocol) - // b[1:4] is RFFU = 0. - // The RFFU field MUST be set to zero on transmission and MUST be - // ignored on reception. It is reserved for future uses. - m.Add(stun.AttrRequestedTransport, v) - return nil -} - -// GetFrom decodes REQUESTED-TRANSPORT from message. -func (t *RequestedTransport) GetFrom(m *stun.Message) error { - v, err := m.Get(stun.AttrRequestedTransport) - if err != nil { - return err - } - if err = stun.CheckSize(stun.AttrRequestedTransport, len(v), requestedTransportSize); err != nil { - return err - } - t.Protocol = Protocol(v[0]) - return nil -} - -// RequestedTransportUDP is setter for requested transport attribute with -// value ProtoUDP (17). -var RequestedTransportUDP stun.Setter = RequestedTransport{ - Protocol: ProtoUDP, -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/rsrvtoken.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/rsrvtoken.go deleted file mode 100644 index 38517ea..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/rsrvtoken.go +++ /dev/null @@ -1,39 +0,0 @@ -package turn - -import "github.com/gortc/stun" - -// ReservationToken represents RESERVATION-TOKEN attribute. -// -// The RESERVATION-TOKEN attribute contains a token that uniquely -// identifies a relayed transport address being held in reserve by the -// server. The server includes this attribute in a success response to -// tell the client about the token, and the client includes this -// attribute in a subsequent Allocate request to request the server use -// that relayed transport address for the allocation. -// -// RFC 5766 Section 14.9 -type ReservationToken []byte - -const reservationTokenSize = 8 // 8 bytes - -// AddTo adds RESERVATION-TOKEN to message. -func (t ReservationToken) AddTo(m *stun.Message) error { - if err := stun.CheckSize(stun.AttrReservationToken, len(t), reservationTokenSize); err != nil { - return err - } - m.Add(stun.AttrReservationToken, t) - return nil -} - -// GetFrom decodes RESERVATION-TOKEN from message. -func (t *ReservationToken) GetFrom(m *stun.Message) error { - v, err := m.Get(stun.AttrReservationToken) - if err != nil { - return err - } - if err = stun.CheckSize(stun.AttrReservationToken, len(v), reservationTokenSize); err != nil { - return err - } - *t = v - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/turn.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/turn.go deleted file mode 100644 index 7a174d0..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/turn.go +++ /dev/null @@ -1,30 +0,0 @@ -// Package turn implements RFC 5766 Traversal Using Relays around NAT. -package turn - -import ( - "encoding/binary" - - "github.com/gortc/stun" -) - -// bin is shorthand for binary.BigEndian. -var bin = binary.BigEndian - -// Default ports for TURN from RFC 5766 Section 4. -const ( - // DefaultPort for TURN is same as STUN. - DefaultPort = stun.DefaultPort - // DefaultTLSPort is for TURN over TLS and is same as STUN. - DefaultTLSPort = stun.DefaultTLSPort -) - -var ( - // AllocateRequest is shorthand for allocation request message type. - AllocateRequest = stun.NewType(stun.MethodAllocate, stun.ClassRequest) - // CreatePermissionRequest is shorthand for create permission request type. - CreatePermissionRequest = stun.NewType(stun.MethodCreatePermission, stun.ClassRequest) - // SendIndication is shorthand for send indication message type. - SendIndication = stun.NewType(stun.MethodSend, stun.ClassIndication) - // RefreshRequest is shorthand for refresh request message type. - RefreshRequest = stun.NewType(stun.MethodRefresh, stun.ClassRequest) -) diff --git a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/uri.go b/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/uri.go deleted file mode 100644 index 1247217..0000000 --- a/e2e/gortc-turn/turn-client/vendor/github.com/gortc/turn/uri.go +++ /dev/null @@ -1,72 +0,0 @@ -package turn - -import ( - "errors" - "fmt" - "net/url" - "strconv" -) - -// Scheme definitions from RFC 7065 Section 3.2. -const ( - Scheme = "turn" - SchemeSecure = "turns" -) - -// Transport definitions as in RFC 7065. -const ( - TransportTCP = "tcp" - TransportUDP = "udp" -) - -// URI as defined in RFC 7065. -type URI struct { - Scheme string - Host string - Port int - Transport string -} - -func (u URI) String() string { - transportSuffix := "" - if len(u.Transport) > 0 { - transportSuffix = "?transport=" + u.Transport - } - if u.Port != 0 { - return fmt.Sprintf("%s:%s:%d%s", - u.Scheme, u.Host, u.Port, transportSuffix, - ) - } - return u.Scheme + ":" + u.Host + transportSuffix -} - -// ParseURI parses URI from string. -func ParseURI(rawURI string) (URI, error) { - // Carefully reusing URI parser from net/url. - u, urlParseErr := url.Parse(rawURI) - if urlParseErr != nil { - return URI{}, urlParseErr - } - if u.Scheme != Scheme && u.Scheme != SchemeSecure { - return URI{}, fmt.Errorf("unknown uri scheme %q", u.Scheme) - } - if u.Opaque == "" { - return URI{}, errors.New("invalid uri format: expected opaque") - } - // Using URL methods to split host. - u.Host = u.Opaque - host, rawPort := u.Hostname(), u.Port() - uri := URI{ - Scheme: u.Scheme, - Host: host, - Transport: u.Query().Get("transport"), - } - if len(rawPort) > 0 { - port, portErr := strconv.Atoi(rawPort) - if portErr != nil { - return uri, fmt.Errorf("failed to parse %q as port: %v", rawPort, portErr) - } - uri.Port = port - } - return uri, nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/.gitignore b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/.gitignore deleted file mode 100644 index 0a4504f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.DS_Store -/vendor -/cover -cover.out -lint.log - -# Binaries -*.test - -# Profiling output -*.prof diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/.travis.yml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/.travis.yml deleted file mode 100644 index f1ce95a..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: false -language: go -go_import_path: go.uber.org/atomic - -go: - - 1.5 - - 1.6 - - tip - -cache: - directories: - - vendor - -install: - - make install_ci - -script: - - make test_ci - - scripts/test-ubergo.sh - - make lint - - travis_retry goveralls -coverprofile=cover.out -service=travis-ci diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/LICENSE.txt b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/LICENSE.txt deleted file mode 100644 index 8765c9f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016 Uber Technologies, Inc. - -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/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/Makefile b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/Makefile deleted file mode 100644 index dfc63d9..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -PACKAGES := $(shell glide nv) -# Many Go tools take file globs or directories as arguments instead of packages. -PACKAGE_FILES ?= *.go - - -# The linting tools evolve with each Go version, so run them only on the latest -# stable release. -GO_VERSION := $(shell go version | cut -d " " -f 3) -GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) -LINTABLE_MINOR_VERSIONS := 7 8 -ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) -SHOULD_LINT := true -endif - - -export GO15VENDOREXPERIMENT=1 - - -.PHONY: build -build: - go build -i $(PACKAGES) - - -.PHONY: install -install: - glide --version || go get github.com/Masterminds/glide - glide install - - -.PHONY: test -test: - go test -cover -race $(PACKAGES) - - -.PHONY: install_ci -install_ci: install - go get github.com/wadey/gocovmerge - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover -ifdef SHOULD_LINT - go get github.com/golang/lint/golint -endif - -.PHONY: lint -lint: -ifdef SHOULD_LINT - @rm -rf lint.log - @echo "Checking formatting..." - @gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log - @echo "Checking vet..." - @$(foreach dir,$(PACKAGE_FILES),go tool vet $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking lint..." - @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking for unresolved FIXMEs..." - @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log - @[ ! -s lint.log ] -else - @echo "Skipping linters on" $(GO_VERSION) -endif - - -.PHONY: test_ci -test_ci: install_ci build - ./scripts/cover.sh $(shell go list $(PACKAGES)) diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/README.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/README.md deleted file mode 100644 index bb4a12c..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] - -Simple wrappers for primitive types to enforce atomic access. - -## Installation -`go get -u go.uber.org/atomic` - -## Usage -The standard library's `sync/atomic` is powerful, but it's easy to forget which -variables must be accessed atomically. `go.uber.org/atomic` preserves all the -functionality of the standard library, but wraps the primitive types to -provide a safer, more convenient API. - -```go -var atom atomic.Uint32 -atom.Store(42) -atom.Sub(2) -atom.CAS(40, 11) -``` - -See the [documentation][doc] for a complete API specification. - -## Development Status -Stable. - -
-Released under the [MIT License](LICENSE.txt). - -[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg -[doc]: https://godoc.org/go.uber.org/atomic -[ci-img]: https://travis-ci.org/uber-go/atomic.svg?branch=master -[ci]: https://travis-ci.org/uber-go/atomic -[cov-img]: https://coveralls.io/repos/github/uber-go/atomic/badge.svg?branch=master -[cov]: https://coveralls.io/github/uber-go/atomic?branch=master diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/atomic.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/atomic.go deleted file mode 100644 index 290b884..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/atomic.go +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -// Package atomic provides simple wrappers around numerics to enforce atomic -// access. -package atomic - -import ( - "math" - "sync/atomic" -) - -// Int32 is an atomic wrapper around an int32. -type Int32 struct{ v int32 } - -// NewInt32 creates an Int32. -func NewInt32(i int32) *Int32 { - return &Int32{i} -} - -// Load atomically loads the wrapped value. -func (i *Int32) Load() int32 { - return atomic.LoadInt32(&i.v) -} - -// Add atomically adds to the wrapped int32 and returns the new value. -func (i *Int32) Add(n int32) int32 { - return atomic.AddInt32(&i.v, n) -} - -// Sub atomically subtracts from the wrapped int32 and returns the new value. -func (i *Int32) Sub(n int32) int32 { - return atomic.AddInt32(&i.v, -n) -} - -// Inc atomically increments the wrapped int32 and returns the new value. -func (i *Int32) Inc() int32 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped int32 and returns the new value. -func (i *Int32) Dec() int32 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Int32) CAS(old, new int32) bool { - return atomic.CompareAndSwapInt32(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Int32) Store(n int32) { - atomic.StoreInt32(&i.v, n) -} - -// Swap atomically swaps the wrapped int32 and returns the old value. -func (i *Int32) Swap(n int32) int32 { - return atomic.SwapInt32(&i.v, n) -} - -// Int64 is an atomic wrapper around an int64. -type Int64 struct{ v int64 } - -// NewInt64 creates an Int64. -func NewInt64(i int64) *Int64 { - return &Int64{i} -} - -// Load atomically loads the wrapped value. -func (i *Int64) Load() int64 { - return atomic.LoadInt64(&i.v) -} - -// Add atomically adds to the wrapped int64 and returns the new value. -func (i *Int64) Add(n int64) int64 { - return atomic.AddInt64(&i.v, n) -} - -// Sub atomically subtracts from the wrapped int64 and returns the new value. -func (i *Int64) Sub(n int64) int64 { - return atomic.AddInt64(&i.v, -n) -} - -// Inc atomically increments the wrapped int64 and returns the new value. -func (i *Int64) Inc() int64 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped int64 and returns the new value. -func (i *Int64) Dec() int64 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Int64) CAS(old, new int64) bool { - return atomic.CompareAndSwapInt64(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Int64) Store(n int64) { - atomic.StoreInt64(&i.v, n) -} - -// Swap atomically swaps the wrapped int64 and returns the old value. -func (i *Int64) Swap(n int64) int64 { - return atomic.SwapInt64(&i.v, n) -} - -// Uint32 is an atomic wrapper around an uint32. -type Uint32 struct{ v uint32 } - -// NewUint32 creates a Uint32. -func NewUint32(i uint32) *Uint32 { - return &Uint32{i} -} - -// Load atomically loads the wrapped value. -func (i *Uint32) Load() uint32 { - return atomic.LoadUint32(&i.v) -} - -// Add atomically adds to the wrapped uint32 and returns the new value. -func (i *Uint32) Add(n uint32) uint32 { - return atomic.AddUint32(&i.v, n) -} - -// Sub atomically subtracts from the wrapped uint32 and returns the new value. -func (i *Uint32) Sub(n uint32) uint32 { - return atomic.AddUint32(&i.v, ^(n - 1)) -} - -// Inc atomically increments the wrapped uint32 and returns the new value. -func (i *Uint32) Inc() uint32 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped int32 and returns the new value. -func (i *Uint32) Dec() uint32 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Uint32) CAS(old, new uint32) bool { - return atomic.CompareAndSwapUint32(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Uint32) Store(n uint32) { - atomic.StoreUint32(&i.v, n) -} - -// Swap atomically swaps the wrapped uint32 and returns the old value. -func (i *Uint32) Swap(n uint32) uint32 { - return atomic.SwapUint32(&i.v, n) -} - -// Uint64 is an atomic wrapper around a uint64. -type Uint64 struct{ v uint64 } - -// NewUint64 creates a Uint64. -func NewUint64(i uint64) *Uint64 { - return &Uint64{i} -} - -// Load atomically loads the wrapped value. -func (i *Uint64) Load() uint64 { - return atomic.LoadUint64(&i.v) -} - -// Add atomically adds to the wrapped uint64 and returns the new value. -func (i *Uint64) Add(n uint64) uint64 { - return atomic.AddUint64(&i.v, n) -} - -// Sub atomically subtracts from the wrapped uint64 and returns the new value. -func (i *Uint64) Sub(n uint64) uint64 { - return atomic.AddUint64(&i.v, ^(n - 1)) -} - -// Inc atomically increments the wrapped uint64 and returns the new value. -func (i *Uint64) Inc() uint64 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped uint64 and returns the new value. -func (i *Uint64) Dec() uint64 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Uint64) CAS(old, new uint64) bool { - return atomic.CompareAndSwapUint64(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Uint64) Store(n uint64) { - atomic.StoreUint64(&i.v, n) -} - -// Swap atomically swaps the wrapped uint64 and returns the old value. -func (i *Uint64) Swap(n uint64) uint64 { - return atomic.SwapUint64(&i.v, n) -} - -// Bool is an atomic Boolean. -type Bool struct{ v uint32 } - -// NewBool creates a Bool. -func NewBool(initial bool) *Bool { - return &Bool{boolToInt(initial)} -} - -// Load atomically loads the Boolean. -func (b *Bool) Load() bool { - return truthy(atomic.LoadUint32(&b.v)) -} - -// Store atomically stores the passed value. -func (b *Bool) Store(new bool) { - atomic.StoreUint32(&b.v, boolToInt(new)) -} - -// Swap sets the given value and returns the previous value. -func (b *Bool) Swap(new bool) bool { - return truthy(atomic.SwapUint32(&b.v, boolToInt(new))) -} - -// Toggle atomically negates the Boolean and returns the previous value. -func (b *Bool) Toggle() bool { - return truthy(atomic.AddUint32(&b.v, 1) - 1) -} - -func truthy(n uint32) bool { - return n&1 == 1 -} - -func boolToInt(b bool) uint32 { - if b { - return 1 - } - return 0 -} - -// Float64 is an atomic wrapper around float64. -type Float64 struct { - v uint64 -} - -// NewFloat64 creates a Float64. -func NewFloat64(f float64) *Float64 { - return &Float64{math.Float64bits(f)} -} - -// Load atomically loads the wrapped value. -func (f *Float64) Load() float64 { - return math.Float64frombits(atomic.LoadUint64(&f.v)) -} - -// Store atomically stores the passed value. -func (f *Float64) Store(s float64) { - atomic.StoreUint64(&f.v, math.Float64bits(s)) -} - -// Add atomically adds to the wrapped float64 and returns the new value. -func (f *Float64) Add(s float64) float64 { - for { - old := f.Load() - new := old + s - if f.CAS(old, new) { - return new - } - } -} - -// Sub atomically subtracts from the wrapped float64 and returns the new value. -func (f *Float64) Sub(s float64) float64 { - return f.Add(-s) -} - -// CAS is an atomic compare-and-swap. -func (f *Float64) CAS(old, new float64) bool { - return atomic.CompareAndSwapUint64(&f.v, math.Float64bits(old), math.Float64bits(new)) -} - -// Value shadows the type of the same name from sync/atomic -// https://godoc.org/sync/atomic#Value -type Value struct{ atomic.Value } diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/glide.lock b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/glide.lock deleted file mode 100644 index 3c72c59..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/glide.lock +++ /dev/null @@ -1,17 +0,0 @@ -hash: f14d51408e3e0e4f73b34e4039484c78059cd7fc5f4996fdd73db20dc8d24f53 -updated: 2016-10-27T00:10:51.16960137-07:00 -imports: [] -testImports: -- name: github.com/davecgh/go-spew - version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/stretchr/testify - version: d77da356e56a7428ad25149ca77381849a6a5232 - subpackages: - - assert - - require diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/glide.yaml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/glide.yaml deleted file mode 100644 index 4cf608e..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/glide.yaml +++ /dev/null @@ -1,6 +0,0 @@ -package: go.uber.org/atomic -testImport: -- package: github.com/stretchr/testify - subpackages: - - assert - - require diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/string.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/string.go deleted file mode 100644 index acf0f5b..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/atomic/string.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package atomic - -import "sync/atomic" - -// String is an atomic type-safe wrapper around atomic.Value for strings. -type String struct{ v atomic.Value } - -// NewString creates a String. -func NewString(str string) *String { - s := &String{} - if str != "" { - s.Store(str) - } - return s -} - -// Load atomically loads the wrapped string. -func (s *String) Load() string { - v := s.v.Load() - if v == nil { - return "" - } - return v.(string) -} - -// Store atomically stores the passed string. -// Note: Converting the string to an interface{} to store in the atomic.Value -// requires an allocation. -func (s *String) Store(str string) { - s.v.Store(str) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.codecov.yml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.codecov.yml deleted file mode 100644 index 6d4d1be..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.codecov.yml +++ /dev/null @@ -1,15 +0,0 @@ -coverage: - range: 80..100 - round: down - precision: 2 - - status: - project: # measuring the overall project coverage - default: # context, you can create multiple ones with custom titles - enabled: yes # must be yes|true to enable this status - target: 100 # specify the target coverage for each commit status - # option: "auto" (must increase from parent commit or pull request base) - # option: "X%" a static target percentage to hit - if_not_found: success # if parent is not found report status as success, error, or failure - if_ci_failed: error # if ci fails report status as success, error, or failure - diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.gitignore b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.gitignore deleted file mode 100644 index 61ead86..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/vendor diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.travis.yml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.travis.yml deleted file mode 100644 index 5ffa8fe..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -sudo: false -language: go -go_import_path: go.uber.org/multierr - -env: - global: - - GO15VENDOREXPERIMENT=1 - -go: - - 1.7 - - 1.8 - - tip - -cache: - directories: - - vendor - -before_install: -- go version - -install: -- | - set -e - make install_ci - -script: -- | - set -e - make lint - make test_ci - -after_success: -- bash <(curl -s https://codecov.io/bash) diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/CHANGELOG.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/CHANGELOG.md deleted file mode 100644 index 898445d..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/CHANGELOG.md +++ /dev/null @@ -1,28 +0,0 @@ -Releases -======== - -v1.1.0 (2017-06-30) -=================== - -- Added an `Errors(error) []error` function to extract the underlying list of - errors for a multierr error. - - -v1.0.0 (2017-05-31) -=================== - -No changes since v0.2.0. This release is committing to making no breaking -changes to the current API in the 1.X series. - - -v0.2.0 (2017-04-11) -=================== - -- Repeatedly appending to the same error is now faster due to fewer - allocations. - - -v0.1.0 (2017-31-03) -=================== - -- Initial release diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/LICENSE.txt b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/LICENSE.txt deleted file mode 100644 index 858e024..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2017 Uber Technologies, Inc. - -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/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/Makefile b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/Makefile deleted file mode 100644 index a7437d0..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -export GO15VENDOREXPERIMENT=1 - -PACKAGES := $(shell glide nv) - -GO_FILES := $(shell \ - find . '(' -path '*/.*' -o -path './vendor' ')' -prune \ - -o -name '*.go' -print | cut -b3-) - -.PHONY: install -install: - glide --version || go get github.com/Masterminds/glide - glide install - -.PHONY: build -build: - go build -i $(PACKAGES) - -.PHONY: test -test: - go test -cover -race $(PACKAGES) - -.PHONY: gofmt -gofmt: - $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) - @gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true - @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false) - -.PHONY: govet -govet: - $(eval VET_LOG := $(shell mktemp -t govet.XXXXX)) - @go vet $(PACKAGES) 2>&1 \ - | grep -v '^exit status' > $(VET_LOG) || true - @[ ! -s "$(VET_LOG)" ] || (echo "govet failed:" | cat - $(VET_LOG) && false) - -.PHONY: golint -golint: - @go get github.com/golang/lint/golint - $(eval LINT_LOG := $(shell mktemp -t golint.XXXXX)) - @cat /dev/null > $(LINT_LOG) - @$(foreach pkg, $(PACKAGES), golint $(pkg) >> $(LINT_LOG) || true;) - @[ ! -s "$(LINT_LOG)" ] || (echo "golint failed:" | cat - $(LINT_LOG) && false) - -.PHONY: staticcheck -staticcheck: - @go get honnef.co/go/tools/cmd/staticcheck - $(eval STATICCHECK_LOG := $(shell mktemp -t staticcheck.XXXXX)) - @staticcheck $(PACKAGES) 2>&1 > $(STATICCHECK_LOG) || true - @[ ! -s "$(STATICCHECK_LOG)" ] || (echo "staticcheck failed:" | cat - $(STATICCHECK_LOG) && false) - -.PHONY: lint -lint: gofmt govet golint staticcheck - -.PHONY: cover -cover: - ./scripts/cover.sh $(shell go list $(PACKAGES)) - go tool cover -html=cover.out -o cover.html - -update-license: - @go get go.uber.org/tools/update-license - @update-license \ - $(shell go list -json $(PACKAGES) | \ - jq -r '.Dir + "/" + (.GoFiles | .[])') - -############################################################################## - -.PHONY: install_ci -install_ci: install - go get github.com/wadey/gocovmerge - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - -.PHONY: test_ci -test_ci: install_ci - ./scripts/cover.sh $(shell go list $(PACKAGES)) diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/README.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/README.md deleted file mode 100644 index 065088f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# multierr [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] - -`multierr` allows combining one or more Go `error`s together. - -## Installation - - go get -u go.uber.org/multierr - -## Status - -Stable: No breaking changes will be made before 2.0. - -------------------------------------------------------------------------------- - -Released under the [MIT License]. - -[MIT License]: LICENSE.txt -[doc-img]: https://godoc.org/go.uber.org/multierr?status.svg -[doc]: https://godoc.org/go.uber.org/multierr -[ci-img]: https://travis-ci.org/uber-go/multierr.svg?branch=master -[cov-img]: https://codecov.io/gh/uber-go/multierr/branch/master/graph/badge.svg -[ci]: https://travis-ci.org/uber-go/multierr -[cov]: https://codecov.io/gh/uber-go/multierr diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/error.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/error.go deleted file mode 100644 index de6ce47..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/error.go +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright (c) 2017 Uber Technologies, Inc. -// -// 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. - -// Package multierr allows combining one or more errors together. -// -// Overview -// -// Errors can be combined with the use of the Combine function. -// -// multierr.Combine( -// reader.Close(), -// writer.Close(), -// conn.Close(), -// ) -// -// If only two errors are being combined, the Append function may be used -// instead. -// -// err = multierr.Combine(reader.Close(), writer.Close()) -// -// This makes it possible to record resource cleanup failures from deferred -// blocks with the help of named return values. -// -// func sendRequest(req Request) (err error) { -// conn, err := openConnection() -// if err != nil { -// return err -// } -// defer func() { -// err = multierr.Append(err, conn.Close()) -// }() -// // ... -// } -// -// The underlying list of errors for a returned error object may be retrieved -// with the Errors function. -// -// errors := multierr.Errors(err) -// if len(errors) > 0 { -// fmt.Println("The following errors occurred:") -// } -// -// Advanced Usage -// -// Errors returned by Combine and Append MAY implement the following -// interface. -// -// type errorGroup interface { -// // Returns a slice containing the underlying list of errors. -// // -// // This slice MUST NOT be modified by the caller. -// Errors() []error -// } -// -// Note that if you need access to list of errors behind a multierr error, you -// should prefer using the Errors function. That said, if you need cheap -// read-only access to the underlying errors slice, you can attempt to cast -// the error to this interface. You MUST handle the failure case gracefully -// because errors returned by Combine and Append are not guaranteed to -// implement this interface. -// -// var errors []error -// group, ok := err.(errorGroup) -// if ok { -// errors = group.Errors() -// } else { -// errors = []error{err} -// } -package multierr // import "go.uber.org/multierr" - -import ( - "bytes" - "fmt" - "io" - "strings" - "sync" - - "go.uber.org/atomic" -) - -var ( - // Separator for single-line error messages. - _singlelineSeparator = []byte("; ") - - _newline = []byte("\n") - - // Prefix for multi-line messages - _multilinePrefix = []byte("the following errors occurred:") - - // Prefix for the first and following lines of an item in a list of - // multi-line error messages. - // - // For example, if a single item is: - // - // foo - // bar - // - // It will become, - // - // - foo - // bar - _multilineSeparator = []byte("\n - ") - _multilineIndent = []byte(" ") -) - -// _bufferPool is a pool of bytes.Buffers. -var _bufferPool = sync.Pool{ - New: func() interface{} { - return &bytes.Buffer{} - }, -} - -type errorGroup interface { - Errors() []error -} - -// Errors returns a slice containing zero or more errors that the supplied -// error is composed of. If the error is nil, the returned slice is empty. -// -// err := multierr.Append(r.Close(), w.Close()) -// errors := multierr.Errors(err) -// -// If the error is not composed of other errors, the returned slice contains -// just the error that was passed in. -// -// Callers of this function are free to modify the returned slice. -func Errors(err error) []error { - if err == nil { - return nil - } - - // Note that we're casting to multiError, not errorGroup. Our contract is - // that returned errors MAY implement errorGroup. Errors, however, only - // has special behavior for multierr-specific error objects. - // - // This behavior can be expanded in the future but I think it's prudent to - // start with as little as possible in terms of contract and possibility - // of misuse. - eg, ok := err.(*multiError) - if !ok { - return []error{err} - } - - errors := eg.Errors() - result := make([]error, len(errors)) - copy(result, errors) - return result -} - -// multiError is an error that holds one or more errors. -// -// An instance of this is guaranteed to be non-empty and flattened. That is, -// none of the errors inside multiError are other multiErrors. -// -// multiError formats to a semi-colon delimited list of error messages with -// %v and with a more readable multi-line format with %+v. -type multiError struct { - copyNeeded atomic.Bool - errors []error -} - -var _ errorGroup = (*multiError)(nil) - -// Errors returns the list of underlying errors. -// -// This slice MUST NOT be modified. -func (merr *multiError) Errors() []error { - if merr == nil { - return nil - } - return merr.errors -} - -func (merr *multiError) Error() string { - if merr == nil { - return "" - } - - buff := _bufferPool.Get().(*bytes.Buffer) - buff.Reset() - - merr.writeSingleline(buff) - - result := buff.String() - _bufferPool.Put(buff) - return result -} - -func (merr *multiError) Format(f fmt.State, c rune) { - if c == 'v' && f.Flag('+') { - merr.writeMultiline(f) - } else { - merr.writeSingleline(f) - } -} - -func (merr *multiError) writeSingleline(w io.Writer) { - first := true - for _, item := range merr.errors { - if first { - first = false - } else { - w.Write(_singlelineSeparator) - } - io.WriteString(w, item.Error()) - } -} - -func (merr *multiError) writeMultiline(w io.Writer) { - w.Write(_multilinePrefix) - for _, item := range merr.errors { - w.Write(_multilineSeparator) - writePrefixLine(w, _multilineIndent, fmt.Sprintf("%+v", item)) - } -} - -// Writes s to the writer with the given prefix added before each line after -// the first. -func writePrefixLine(w io.Writer, prefix []byte, s string) { - first := true - for len(s) > 0 { - if first { - first = false - } else { - w.Write(prefix) - } - - idx := strings.IndexByte(s, '\n') - if idx < 0 { - idx = len(s) - 1 - } - - io.WriteString(w, s[:idx+1]) - s = s[idx+1:] - } -} - -type inspectResult struct { - // Number of top-level non-nil errors - Count int - - // Total number of errors including multiErrors - Capacity int - - // Index of the first non-nil error in the list. Value is meaningless if - // Count is zero. - FirstErrorIdx int - - // Whether the list contains at least one multiError - ContainsMultiError bool -} - -// Inspects the given slice of errors so that we can efficiently allocate -// space for it. -func inspect(errors []error) (res inspectResult) { - first := true - for i, err := range errors { - if err == nil { - continue - } - - res.Count++ - if first { - first = false - res.FirstErrorIdx = i - } - - if merr, ok := err.(*multiError); ok { - res.Capacity += len(merr.errors) - res.ContainsMultiError = true - } else { - res.Capacity++ - } - } - return -} - -// fromSlice converts the given list of errors into a single error. -func fromSlice(errors []error) error { - res := inspect(errors) - switch res.Count { - case 0: - return nil - case 1: - // only one non-nil entry - return errors[res.FirstErrorIdx] - case len(errors): - if !res.ContainsMultiError { - // already flat - return &multiError{errors: errors} - } - } - - nonNilErrs := make([]error, 0, res.Capacity) - for _, err := range errors[res.FirstErrorIdx:] { - if err == nil { - continue - } - - if nested, ok := err.(*multiError); ok { - nonNilErrs = append(nonNilErrs, nested.errors...) - } else { - nonNilErrs = append(nonNilErrs, err) - } - } - - return &multiError{errors: nonNilErrs} -} - -// Combine combines the passed errors into a single error. -// -// If zero arguments were passed or if all items are nil, a nil error is -// returned. -// -// Combine(nil, nil) // == nil -// -// If only a single error was passed, it is returned as-is. -// -// Combine(err) // == err -// -// Combine skips over nil arguments so this function may be used to combine -// together errors from operations that fail independently of each other. -// -// multierr.Combine( -// reader.Close(), -// writer.Close(), -// pipe.Close(), -// ) -// -// If any of the passed errors is a multierr error, it will be flattened along -// with the other errors. -// -// multierr.Combine(multierr.Combine(err1, err2), err3) -// // is the same as -// multierr.Combine(err1, err2, err3) -// -// The returned error formats into a readable multi-line error message if -// formatted with %+v. -// -// fmt.Sprintf("%+v", multierr.Combine(err1, err2)) -func Combine(errors ...error) error { - return fromSlice(errors) -} - -// Append appends the given errors together. Either value may be nil. -// -// This function is a specialization of Combine for the common case where -// there are only two errors. -// -// err = multierr.Append(reader.Close(), writer.Close()) -// -// The following pattern may also be used to record failure of deferred -// operations without losing information about the original error. -// -// func doSomething(..) (err error) { -// f := acquireResource() -// defer func() { -// err = multierr.Append(err, f.Close()) -// }() -func Append(left error, right error) error { - switch { - case left == nil: - return right - case right == nil: - return left - } - - if _, ok := right.(*multiError); !ok { - if l, ok := left.(*multiError); ok && !l.copyNeeded.Swap(true) { - // Common case where the error on the left is constantly being - // appended to. - errs := append(l.errors, right) - return &multiError{errors: errs} - } else if !ok { - // Both errors are single errors. - return &multiError{errors: []error{left, right}} - } - } - - // Either right or both, left and right, are multiErrors. Rely on usual - // expensive logic. - errors := [2]error{left, right} - return fromSlice(errors[0:]) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/glide.lock b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/glide.lock deleted file mode 100644 index f9ea94c..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/glide.lock +++ /dev/null @@ -1,19 +0,0 @@ -hash: b53b5e9a84b9cb3cc4b2d0499e23da2feca1eec318ce9bb717ecf35bf24bf221 -updated: 2017-04-10T13:34:45.671678062-07:00 -imports: -- name: go.uber.org/atomic - version: 3b8db5e93c4c02efbc313e17b2e796b0914a01fb -testImports: -- name: github.com/davecgh/go-spew - version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/stretchr/testify - version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 - subpackages: - - assert - - require diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/glide.yaml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/glide.yaml deleted file mode 100644 index 6ef084e..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/multierr/glide.yaml +++ /dev/null @@ -1,8 +0,0 @@ -package: go.uber.org/multierr -import: -- package: go.uber.org/atomic - version: ^1 -testImport: -- package: github.com/stretchr/testify - subpackages: - - assert diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.codecov.yml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.codecov.yml deleted file mode 100644 index 8e5ca7d..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.codecov.yml +++ /dev/null @@ -1,17 +0,0 @@ -coverage: - range: 80..100 - round: down - precision: 2 - - status: - project: # measuring the overall project coverage - default: # context, you can create multiple ones with custom titles - enabled: yes # must be yes|true to enable this status - target: 95% # specify the target coverage for each commit status - # option: "auto" (must increase from parent commit or pull request base) - # option: "X%" a static target percentage to hit - if_not_found: success # if parent is not found report status as success, error, or failure - if_ci_failed: error # if ci fails report status as success, error, or failure -ignore: - - internal/readme/readme.go - diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.gitignore b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.gitignore deleted file mode 100644 index 08fbde6..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test -vendor - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof -*.pprof -*.out -*.log diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.readme.tmpl b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.readme.tmpl deleted file mode 100644 index c6440db..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.readme.tmpl +++ /dev/null @@ -1,108 +0,0 @@ -# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] - -Blazing fast, structured, leveled logging in Go. - -## Installation - -`go get -u go.uber.org/zap` - -Note that zap only supports the two most recent minor versions of Go. - -## Quick Start - -In contexts where performance is nice, but not critical, use the -`SugaredLogger`. It's 4-10x faster than other structured logging -packages and includes both structured and `printf`-style APIs. - -```go -logger, _ := zap.NewProduction() -defer logger.Sync() // flushes buffer, if any -sugar := logger.Sugar() -sugar.Infow("failed to fetch URL", - // Structured context as loosely typed key-value pairs. - "url", url, - "attempt", 3, - "backoff", time.Second, -) -sugar.Infof("Failed to fetch URL: %s", url) -``` - -When performance and type safety are critical, use the `Logger`. It's even -faster than the `SugaredLogger` and allocates far less, but it only supports -structured logging. - -```go -logger, _ := zap.NewProduction() -defer logger.Sync() -logger.Info("failed to fetch URL", - // Structured context as strongly typed Field values. - zap.String("url", url), - zap.Int("attempt", 3), - zap.Duration("backoff", time.Second), -) -``` - -See the [documentation][doc] and [FAQ](FAQ.md) for more details. - -## Performance - -For applications that log in the hot path, reflection-based serialization and -string formatting are prohibitively expensive — they're CPU-intensive -and make many small allocations. Put differently, using `encoding/json` and -`fmt.Fprintf` to log tons of `interface{}`s makes your application slow. - -Zap takes a different approach. It includes a reflection-free, zero-allocation -JSON encoder, and the base `Logger` strives to avoid serialization overhead -and allocations wherever possible. By building the high-level `SugaredLogger` -on that foundation, zap lets users *choose* when they need to count every -allocation and when they'd prefer a more familiar, loosely typed API. - -As measured by its own [benchmarking suite][], not only is zap more performant -than comparable structured logging packages — it's also faster than the -standard library. Like all benchmarks, take these with a grain of salt.[1](#footnote-versions) - -Log a message and 10 fields: - -{{.BenchmarkAddingFields}} - -Log a message with a logger that already has 10 fields of context: - -{{.BenchmarkAccumulatedContext}} - -Log a static string, without any context or `printf`-style templating: - -{{.BenchmarkWithoutFields}} - -## Development Status: Stable - -All APIs are finalized, and no breaking changes will be made in the 1.x series -of releases. Users of semver-aware dependency management systems should pin -zap to `^1`. - -## Contributing - -We encourage and support an active, healthy community of contributors — -including you! Details are in the [contribution guide](CONTRIBUTING.md) and -the [code of conduct](CODE_OF_CONDUCT.md). The zap maintainers keep an eye on -issues and pull requests, but you can also report any negative conduct to -oss-conduct@uber.com. That email list is a private, safe space; even the zap -maintainers don't have access, so don't hesitate to hold us to a high -standard. - -
- -Released under the [MIT License](LICENSE.txt). - -1 In particular, keep in mind that we may be -benchmarking against slightly older versions of other packages. Versions are -pinned in zap's [glide.lock][] file. [↩](#anchor-versions) - -[doc-img]: https://godoc.org/go.uber.org/zap?status.svg -[doc]: https://godoc.org/go.uber.org/zap -[ci-img]: https://travis-ci.org/uber-go/zap.svg?branch=master -[ci]: https://travis-ci.org/uber-go/zap -[cov-img]: https://codecov.io/gh/uber-go/zap/branch/master/graph/badge.svg -[cov]: https://codecov.io/gh/uber-go/zap -[benchmarking suite]: https://github.com/uber-go/zap/tree/master/benchmarks -[glide.lock]: https://github.com/uber-go/zap/blob/master/glide.lock diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.travis.yml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.travis.yml deleted file mode 100644 index a3321fa..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: go -sudo: false -go: - - 1.9.x - - 1.10.x -go_import_path: go.uber.org/zap -env: - global: - - TEST_TIMEOUT_SCALE=10 -cache: - directories: - - vendor -install: - - make dependencies -script: - - make lint - - make test - - make bench -after_success: - - make cover - - bash <(curl -s https://codecov.io/bash) diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CHANGELOG.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CHANGELOG.md deleted file mode 100644 index 17d5b49..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CHANGELOG.md +++ /dev/null @@ -1,305 +0,0 @@ -# Changelog - -## v1.9.1 (06 Aug 2018) - -Bugfixes: - -* [#614][]: MapObjectEncoder should not ignore empty slices. - -## v1.9.0 (19 Jul 2018) - -Enhancements: -* [#602][]: Reduce number of allocations when logging with reflection. -* [#572][], [#606][]: Expose a registry for third-party logging sinks. - -Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and -@dimroc for their contributions to this release. - -## v1.8.0 (13 Apr 2018) - -Enhancements: -* [#508][]: Make log level configurable when redirecting the standard - library's logger. -* [#518][]: Add a logger that writes to a `*testing.TB`. -* [#577][]: Add a top-level alias for `zapcore.Field` to clean up GoDoc. - -Bugfixes: -* [#574][]: Add a missing import comment to `go.uber.org/zap/buffer`. - -Thanks to @DiSiqueira and @djui for their contributions to this release. - -## v1.7.1 (25 Sep 2017) - -Bugfixes: -* [#504][]: Store strings when using AddByteString with the map encoder. - -## v1.7.0 (21 Sep 2017) - -Enhancements: - -* [#487][]: Add `NewStdLogAt`, which extends `NewStdLog` by allowing the user - to specify the level of the logged messages. - -## v1.6.0 (30 Aug 2017) - -Enhancements: - -* [#491][]: Omit zap stack frames from stacktraces. -* [#490][]: Add a `ContextMap` method to observer logs for simpler - field validation in tests. - -## v1.5.0 (22 Jul 2017) - -Enhancements: - -* [#460][] and [#470][]: Support errors produced by `go.uber.org/multierr`. -* [#465][]: Support user-supplied encoders for logger names. - -Bugfixes: - -* [#477][]: Fix a bug that incorrectly truncated deep stacktraces. - -Thanks to @richard-tunein and @pavius for their contributions to this release. - -## v1.4.1 (08 Jun 2017) - -This release fixes two bugs. - -Bugfixes: - -* [#435][]: Support a variety of case conventions when unmarshaling levels. -* [#444][]: Fix a panic in the observer. - -## v1.4.0 (12 May 2017) - -This release adds a few small features and is fully backward-compatible. - -Enhancements: - -* [#424][]: Add a `LineEnding` field to `EncoderConfig`, allowing users to - override the Unix-style default. -* [#425][]: Preserve time zones when logging times. -* [#431][]: Make `zap.AtomicLevel` implement `fmt.Stringer`, which makes a - variety of operations a bit simpler. - -## v1.3.0 (25 Apr 2017) - -This release adds an enhancement to zap's testing helpers as well as the -ability to marshal an AtomicLevel. It is fully backward-compatible. - -Enhancements: - -* [#415][]: Add a substring-filtering helper to zap's observer. This is - particularly useful when testing the `SugaredLogger`. -* [#416][]: Make `AtomicLevel` implement `encoding.TextMarshaler`. - -## v1.2.0 (13 Apr 2017) - -This release adds a gRPC compatibility wrapper. It is fully backward-compatible. - -Enhancements: - -* [#402][]: Add a `zapgrpc` package that wraps zap's Logger and implements - `grpclog.Logger`. - -## v1.1.0 (31 Mar 2017) - -This release fixes two bugs and adds some enhancements to zap's testing helpers. -It is fully backward-compatible. - -Bugfixes: - -* [#385][]: Fix caller path trimming on Windows. -* [#396][]: Fix a panic when attempting to use non-existent directories with - zap's configuration struct. - -Enhancements: - -* [#386][]: Add filtering helpers to zaptest's observing logger. - -Thanks to @moitias for contributing to this release. - -## v1.0.0 (14 Mar 2017) - -This is zap's first stable release. All exported APIs are now final, and no -further breaking changes will be made in the 1.x release series. Anyone using a -semver-aware dependency manager should now pin to `^1`. - -Breaking changes: - -* [#366][]: Add byte-oriented APIs to encoders to log UTF-8 encoded text without - casting from `[]byte` to `string`. -* [#364][]: To support buffering outputs, add `Sync` methods to `zapcore.Core`, - `zap.Logger`, and `zap.SugaredLogger`. -* [#371][]: Rename the `testutils` package to `zaptest`, which is less likely to - clash with other testing helpers. - -Bugfixes: - -* [#362][]: Make the ISO8601 time formatters fixed-width, which is friendlier - for tab-separated console output. -* [#369][]: Remove the automatic locks in `zapcore.NewCore`, which allows zap to - work with concurrency-safe `WriteSyncer` implementations. -* [#347][]: Stop reporting errors when trying to `fsync` standard out on Linux - systems. -* [#373][]: Report the correct caller from zap's standard library - interoperability wrappers. - -Enhancements: - -* [#348][]: Add a registry allowing third-party encodings to work with zap's - built-in `Config`. -* [#327][]: Make the representation of logger callers configurable (like times, - levels, and durations). -* [#376][]: Allow third-party encoders to use their own buffer pools, which - removes the last performance advantage that zap's encoders have over plugins. -* [#346][]: Add `CombineWriteSyncers`, a convenience function to tee multiple - `WriteSyncer`s and lock the result. -* [#365][]: Make zap's stacktraces compatible with mid-stack inlining (coming in - Go 1.9). -* [#372][]: Export zap's observing logger as `zaptest/observer`. This makes it - easier for particularly punctilious users to unit test their application's - logging. - -Thanks to @suyash, @htrendev, @flisky, @Ulexus, and @skipor for their -contributions to this release. - -## v1.0.0-rc.3 (7 Mar 2017) - -This is the third release candidate for zap's stable release. There are no -breaking changes. - -Bugfixes: - -* [#339][]: Byte slices passed to `zap.Any` are now correctly treated as binary blobs - rather than `[]uint8`. - -Enhancements: - -* [#307][]: Users can opt into colored output for log levels. -* [#353][]: In addition to hijacking the output of the standard library's - package-global logging functions, users can now construct a zap-backed - `log.Logger` instance. -* [#311][]: Frames from common runtime functions and some of zap's internal - machinery are now omitted from stacktraces. - -Thanks to @ansel1 and @suyash for their contributions to this release. - -## v1.0.0-rc.2 (21 Feb 2017) - -This is the second release candidate for zap's stable release. It includes two -breaking changes. - -Breaking changes: - -* [#316][]: Zap's global loggers are now fully concurrency-safe - (previously, users had to ensure that `ReplaceGlobals` was called before the - loggers were in use). However, they must now be accessed via the `L()` and - `S()` functions. Users can update their projects with - - ``` - gofmt -r "zap.L -> zap.L()" -w . - gofmt -r "zap.S -> zap.S()" -w . - ``` -* [#309][] and [#317][]: RC1 was mistakenly shipped with invalid - JSON and YAML struct tags on all config structs. This release fixes the tags - and adds static analysis to prevent similar bugs in the future. - -Bugfixes: - -* [#321][]: Redirecting the standard library's `log` output now - correctly reports the logger's caller. - -Enhancements: - -* [#325][] and [#333][]: Zap now transparently supports non-standard, rich - errors like those produced by `github.com/pkg/errors`. -* [#326][]: Though `New(nil)` continues to return a no-op logger, `NewNop()` is - now preferred. Users can update their projects with `gofmt -r 'zap.New(nil) -> - zap.NewNop()' -w .`. -* [#300][]: Incorrectly importing zap as `github.com/uber-go/zap` now returns a - more informative error. - -Thanks to @skipor and @chapsuk for their contributions to this release. - -## v1.0.0-rc.1 (14 Feb 2017) - -This is the first release candidate for zap's stable release. There are multiple -breaking changes and improvements from the pre-release version. Most notably: - -* **Zap's import path is now "go.uber.org/zap"** — all users will - need to update their code. -* User-facing types and functions remain in the `zap` package. Code relevant - largely to extension authors is now in the `zapcore` package. -* The `zapcore.Core` type makes it easy for third-party packages to use zap's - internals but provide a different user-facing API. -* `Logger` is now a concrete type instead of an interface. -* A less verbose (though slower) logging API is included by default. -* Package-global loggers `L` and `S` are included. -* A human-friendly console encoder is included. -* A declarative config struct allows common logger configurations to be managed - as configuration instead of code. -* Sampling is more accurate, and doesn't depend on the standard library's shared - timer heap. - -## v0.1.0-beta.1 (6 Feb 2017) - -This is a minor version, tagged to allow users to pin to the pre-1.0 APIs and -upgrade at their leisure. Since this is the first tagged release, there are no -backward compatibility concerns and all functionality is new. - -Early zap adopters should pin to the 0.1.x minor version until they're ready to -upgrade to the upcoming stable release. - -[#316]: https://github.com/uber-go/zap/pull/316 -[#309]: https://github.com/uber-go/zap/pull/309 -[#317]: https://github.com/uber-go/zap/pull/317 -[#321]: https://github.com/uber-go/zap/pull/321 -[#325]: https://github.com/uber-go/zap/pull/325 -[#333]: https://github.com/uber-go/zap/pull/333 -[#326]: https://github.com/uber-go/zap/pull/326 -[#300]: https://github.com/uber-go/zap/pull/300 -[#339]: https://github.com/uber-go/zap/pull/339 -[#307]: https://github.com/uber-go/zap/pull/307 -[#353]: https://github.com/uber-go/zap/pull/353 -[#311]: https://github.com/uber-go/zap/pull/311 -[#366]: https://github.com/uber-go/zap/pull/366 -[#364]: https://github.com/uber-go/zap/pull/364 -[#371]: https://github.com/uber-go/zap/pull/371 -[#362]: https://github.com/uber-go/zap/pull/362 -[#369]: https://github.com/uber-go/zap/pull/369 -[#347]: https://github.com/uber-go/zap/pull/347 -[#373]: https://github.com/uber-go/zap/pull/373 -[#348]: https://github.com/uber-go/zap/pull/348 -[#327]: https://github.com/uber-go/zap/pull/327 -[#376]: https://github.com/uber-go/zap/pull/376 -[#346]: https://github.com/uber-go/zap/pull/346 -[#365]: https://github.com/uber-go/zap/pull/365 -[#372]: https://github.com/uber-go/zap/pull/372 -[#385]: https://github.com/uber-go/zap/pull/385 -[#396]: https://github.com/uber-go/zap/pull/396 -[#386]: https://github.com/uber-go/zap/pull/386 -[#402]: https://github.com/uber-go/zap/pull/402 -[#415]: https://github.com/uber-go/zap/pull/415 -[#416]: https://github.com/uber-go/zap/pull/416 -[#424]: https://github.com/uber-go/zap/pull/424 -[#425]: https://github.com/uber-go/zap/pull/425 -[#431]: https://github.com/uber-go/zap/pull/431 -[#435]: https://github.com/uber-go/zap/pull/435 -[#444]: https://github.com/uber-go/zap/pull/444 -[#477]: https://github.com/uber-go/zap/pull/477 -[#465]: https://github.com/uber-go/zap/pull/465 -[#460]: https://github.com/uber-go/zap/pull/460 -[#470]: https://github.com/uber-go/zap/pull/470 -[#487]: https://github.com/uber-go/zap/pull/487 -[#490]: https://github.com/uber-go/zap/pull/490 -[#491]: https://github.com/uber-go/zap/pull/491 -[#504]: https://github.com/uber-go/zap/pull/504 -[#508]: https://github.com/uber-go/zap/pull/508 -[#518]: https://github.com/uber-go/zap/pull/518 -[#577]: https://github.com/uber-go/zap/pull/577 -[#574]: https://github.com/uber-go/zap/pull/574 -[#602]: https://github.com/uber-go/zap/pull/602 -[#572]: https://github.com/uber-go/zap/pull/572 -[#606]: https://github.com/uber-go/zap/pull/606 -[#614]: https://github.com/uber-go/zap/pull/614 diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md deleted file mode 100644 index e327d9a..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,75 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, -body size, disability, ethnicity, gender identity and expression, level of -experience, nationality, personal appearance, race, religion, or sexual -identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an -appointed representative at an online or offline event. Representation of a -project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at oss-conduct@uber.com. The project -team will review and investigate all complaints, and will respond in a way -that it deems appropriate to the circumstances. The project team is obligated -to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 1.4, available at -[http://contributor-covenant.org/version/1/4][version]. - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CONTRIBUTING.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CONTRIBUTING.md deleted file mode 100644 index 9454bba..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/CONTRIBUTING.md +++ /dev/null @@ -1,81 +0,0 @@ -# Contributing - -We'd love your help making zap the very best structured logging library in Go! - -If you'd like to add new exported APIs, please [open an issue][open-issue] -describing your proposal — discussing API changes ahead of time makes -pull request review much smoother. In your issue, pull request, and any other -communications, please remember to treat your fellow contributors with -respect! We take our [code of conduct](CODE_OF_CONDUCT.md) seriously. - -Note that you'll need to sign [Uber's Contributor License Agreement][cla] -before we can accept any of your contributions. If necessary, a bot will remind -you to accept the CLA when you open your pull request. - -## Setup - -[Fork][fork], then clone the repository: - -``` -mkdir -p $GOPATH/src/go.uber.org -cd $GOPATH/src/go.uber.org -git clone git@github.com:your_github_username/zap.git -cd zap -git remote add upstream https://github.com/uber-go/zap.git -git fetch upstream -``` - -Install zap's dependencies: - -``` -make dependencies -``` - -Make sure that the tests and the linters pass: - -``` -make test -make lint -``` - -If you're not using the minor version of Go specified in the Makefile's -`LINTABLE_MINOR_VERSIONS` variable, `make lint` doesn't do anything. This is -fine, but it means that you'll only discover lint failures after you open your -pull request. - -## Making Changes - -Start by creating a new branch for your changes: - -``` -cd $GOPATH/src/go.uber.org/zap -git checkout master -git fetch upstream -git rebase upstream/master -git checkout -b cool_new_feature -``` - -Make your changes, then ensure that `make lint` and `make test` still pass. If -you're satisfied with your changes, push them to your fork. - -``` -git push origin cool_new_feature -``` - -Then use the GitHub UI to open a pull request. - -At this point, you're waiting on us to review your changes. We *try* to respond -to issues and pull requests within a few business days, and we may suggest some -improvements or alternatives. Once your changes are approved, one of the -project maintainers will merge them. - -We're much more likely to approve your changes if you: - -* Add tests for new functionality. -* Write a [good commit message][commit-message]. -* Maintain backward compatibility. - -[fork]: https://github.com/uber-go/zap/fork -[open-issue]: https://github.com/uber-go/zap/issues/new -[cla]: https://cla-assistant.io/uber-go/zap -[commit-message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/FAQ.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/FAQ.md deleted file mode 100644 index 4256d35..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/FAQ.md +++ /dev/null @@ -1,155 +0,0 @@ -# Frequently Asked Questions - -## Design - -### Why spend so much effort on logger performance? - -Of course, most applications won't notice the impact of a slow logger: they -already take tens or hundreds of milliseconds for each operation, so an extra -millisecond doesn't matter. - -On the other hand, why *not* make structured logging fast? The `SugaredLogger` -isn't any harder to use than other logging packages, and the `Logger` makes -structured logging possible in performance-sensitive contexts. Across a fleet -of Go microservices, making each application even slightly more efficient adds -up quickly. - -### Why aren't `Logger` and `SugaredLogger` interfaces? - -Unlike the familiar `io.Writer` and `http.Handler`, `Logger` and -`SugaredLogger` interfaces would include *many* methods. As [Rob Pike points -out][go-proverbs], "The bigger the interface, the weaker the abstraction." -Interfaces are also rigid — *any* change requires releasing a new major -version, since it breaks all third-party implementations. - -Making the `Logger` and `SugaredLogger` concrete types doesn't sacrifice much -abstraction, and it lets us add methods without introducing breaking changes. -Your applications should define and depend upon an interface that includes -just the methods you use. - -### Why sample application logs? - -Applications often experience runs of errors, either because of a bug or -because of a misbehaving user. Logging errors is usually a good idea, but it -can easily make this bad situation worse: not only is your application coping -with a flood of errors, it's also spending extra CPU cycles and I/O logging -those errors. Since writes are typically serialized, logging limits throughput -when you need it most. - -Sampling fixes this problem by dropping repetitive log entries. Under normal -conditions, your application writes out every entry. When similar entries are -logged hundreds or thousands of times each second, though, zap begins dropping -duplicates to preserve throughput. - -### Why do the structured logging APIs take a message in addition to fields? - -Subjectively, we find it helpful to accompany structured context with a brief -description. This isn't critical during development, but it makes debugging -and operating unfamiliar systems much easier. - -More concretely, zap's sampling algorithm uses the message to identify -duplicate entries. In our experience, this is a practical middle ground -between random sampling (which often drops the exact entry that you need while -debugging) and hashing the complete entry (which is prohibitively expensive). - -### Why include package-global loggers? - -Since so many other logging packages include a global logger, many -applications aren't designed to accept loggers as explicit parameters. -Changing function signatures is often a breaking change, so zap includes -global loggers to simplify migration. - -Avoid them where possible. - -### Why include dedicated Panic and Fatal log levels? - -In general, application code should handle errors gracefully instead of using -`panic` or `os.Exit`. However, every rule has exceptions, and it's common to -crash when an error is truly unrecoverable. To avoid losing any information -— especially the reason for the crash — the logger must flush any -buffered entries before the process exits. - -Zap makes this easy by offering `Panic` and `Fatal` logging methods that -automatically flush before exiting. Of course, this doesn't guarantee that -logs will never be lost, but it eliminates a common error. - -See the discussion in uber-go/zap#207 for more details. - -### What's `DPanic`? - -`DPanic` stands for "panic in development." In development, it logs at -`PanicLevel`; otherwise, it logs at `ErrorLevel`. `DPanic` makes it easier to -catch errors that are theoretically possible, but shouldn't actually happen, -*without* crashing in production. - -If you've ever written code like this, you need `DPanic`: - -```go -if err != nil { - panic(fmt.Sprintf("shouldn't ever get here: %v", err)) -} -``` - -## Installation - -### What does the error `expects import "go.uber.org/zap"` mean? - -Either zap was installed incorrectly or you're referencing the wrong package -name in your code. - -Zap's source code happens to be hosted on GitHub, but the [import -path][import-path] is `go.uber.org/zap`. This gives us, the project -maintainers, the freedom to move the source code if necessary. However, it -means that you need to take a little care when installing and using the -package. - -If you follow two simple rules, everything should work: install zap with `go -get -u go.uber.org/zap`, and always import it in your code with `import -"go.uber.org/zap"`. Your code shouldn't contain *any* references to -`github.com/uber-go/zap`. - -## Usage - -### Does zap support log rotation? - -Zap doesn't natively support rotating log files, since we prefer to leave this -to an external program like `logrotate`. - -However, it's easy to integrate a log rotation package like -[`gopkg.in/natefinch/lumberjack.v2`][lumberjack] as a `zapcore.WriteSyncer`. - -```go -// lumberjack.Logger is already safe for concurrent use, so we don't need to -// lock it. -w := zapcore.AddSync(&lumberjack.Logger{ - Filename: "/var/log/myapp/foo.log", - MaxSize: 500, // megabytes - MaxBackups: 3, - MaxAge: 28, // days -}) -core := zapcore.NewCore( - zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()), - w, - zap.InfoLevel, -) -logger := zap.New(core) -``` - -## Extensions - -We'd love to support every logging need within zap itself, but we're only -familiar with a handful of log ingestion systems, flag-parsing packages, and -the like. Rather than merging code that we can't effectively debug and -support, we'd rather grow an ecosystem of zap extensions. - -We're aware of the following extensions, but haven't used them ourselves: - -| Package | Integration | -| --- | --- | -| `github.com/tchap/zapext` | Sentry, syslog | -| `github.com/fgrosse/zaptest` | Ginkgo | -| `github.com/blendle/zapdriver` | Stackdriver | - -[go-proverbs]: https://go-proverbs.github.io/ -[import-path]: https://golang.org/cmd/go/#hdr-Remote_import_paths -[lumberjack]: https://godoc.org/gopkg.in/natefinch/lumberjack.v2 diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/LICENSE.txt b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/LICENSE.txt deleted file mode 100644 index 6652bed..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016-2017 Uber Technologies, Inc. - -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/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/Makefile b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/Makefile deleted file mode 100644 index ef7893b..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -export GO15VENDOREXPERIMENT=1 - -BENCH_FLAGS ?= -cpuprofile=cpu.pprof -memprofile=mem.pprof -benchmem -PKGS ?= $(shell glide novendor) -# Many Go tools take file globs or directories as arguments instead of packages. -PKG_FILES ?= *.go zapcore benchmarks buffer zapgrpc zaptest zaptest/observer internal/bufferpool internal/exit internal/color internal/ztest - -# The linting tools evolve with each Go version, so run them only on the latest -# stable release. -GO_VERSION := $(shell go version | cut -d " " -f 3) -GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) -LINTABLE_MINOR_VERSIONS := 10 -ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) -SHOULD_LINT := true -endif - - -.PHONY: all -all: lint test - -.PHONY: dependencies -dependencies: - @echo "Installing Glide and locked dependencies..." - glide --version || go get -u -f github.com/Masterminds/glide - glide install - @echo "Installing test dependencies..." - go install ./vendor/github.com/axw/gocov/gocov - go install ./vendor/github.com/mattn/goveralls -ifdef SHOULD_LINT - @echo "Installing golint..." - go install ./vendor/github.com/golang/lint/golint -else - @echo "Not installing golint, since we don't expect to lint on" $(GO_VERSION) -endif - -# Disable printf-like invocation checking due to testify.assert.Error() -VET_RULES := -printf=false - -.PHONY: lint -lint: -ifdef SHOULD_LINT - @rm -rf lint.log - @echo "Checking formatting..." - @gofmt -d -s $(PKG_FILES) 2>&1 | tee lint.log - @echo "Installing test dependencies for vet..." - @go test -i $(PKGS) - @echo "Checking vet..." - @$(foreach dir,$(PKG_FILES),go tool vet $(VET_RULES) $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking lint..." - @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking for unresolved FIXMEs..." - @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log - @echo "Checking for license headers..." - @./check_license.sh | tee -a lint.log - @[ ! -s lint.log ] -else - @echo "Skipping linters on" $(GO_VERSION) -endif - -.PHONY: test -test: - go test -race $(PKGS) - -.PHONY: cover -cover: - ./scripts/cover.sh $(PKGS) - -.PHONY: bench -BENCH ?= . -bench: - @$(foreach pkg,$(PKGS),go test -bench=$(BENCH) -run="^$$" $(BENCH_FLAGS) $(pkg);) - -.PHONY: updatereadme -updatereadme: - rm -f README.md - cat .readme.tmpl | go run internal/readme/readme.go > README.md diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/README.md b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/README.md deleted file mode 100644 index f4fd1cb..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] - -Blazing fast, structured, leveled logging in Go. - -## Installation - -`go get -u go.uber.org/zap` - -Note that zap only supports the two most recent minor versions of Go. - -## Quick Start - -In contexts where performance is nice, but not critical, use the -`SugaredLogger`. It's 4-10x faster than other structured logging -packages and includes both structured and `printf`-style APIs. - -```go -logger, _ := zap.NewProduction() -defer logger.Sync() // flushes buffer, if any -sugar := logger.Sugar() -sugar.Infow("failed to fetch URL", - // Structured context as loosely typed key-value pairs. - "url", url, - "attempt", 3, - "backoff", time.Second, -) -sugar.Infof("Failed to fetch URL: %s", url) -``` - -When performance and type safety are critical, use the `Logger`. It's even -faster than the `SugaredLogger` and allocates far less, but it only supports -structured logging. - -```go -logger, _ := zap.NewProduction() -defer logger.Sync() -logger.Info("failed to fetch URL", - // Structured context as strongly typed Field values. - zap.String("url", url), - zap.Int("attempt", 3), - zap.Duration("backoff", time.Second), -) -``` - -See the [documentation][doc] and [FAQ](FAQ.md) for more details. - -## Performance - -For applications that log in the hot path, reflection-based serialization and -string formatting are prohibitively expensive — they're CPU-intensive -and make many small allocations. Put differently, using `encoding/json` and -`fmt.Fprintf` to log tons of `interface{}`s makes your application slow. - -Zap takes a different approach. It includes a reflection-free, zero-allocation -JSON encoder, and the base `Logger` strives to avoid serialization overhead -and allocations wherever possible. By building the high-level `SugaredLogger` -on that foundation, zap lets users *choose* when they need to count every -allocation and when they'd prefer a more familiar, loosely typed API. - -As measured by its own [benchmarking suite][], not only is zap more performant -than comparable structured logging packages — it's also faster than the -standard library. Like all benchmarks, take these with a grain of salt.[1](#footnote-versions) - -Log a message and 10 fields: - -| Package | Time | Objects Allocated | -| :--- | :---: | :---: | -| :zap: zap | 3131 ns/op | 5 allocs/op | -| :zap: zap (sugared) | 4173 ns/op | 21 allocs/op | -| zerolog | 16154 ns/op | 90 allocs/op | -| lion | 16341 ns/op | 111 allocs/op | -| go-kit | 17049 ns/op | 126 allocs/op | -| logrus | 23662 ns/op | 142 allocs/op | -| log15 | 36351 ns/op | 149 allocs/op | -| apex/log | 42530 ns/op | 126 allocs/op | - -Log a message with a logger that already has 10 fields of context: - -| Package | Time | Objects Allocated | -| :--- | :---: | :---: | -| :zap: zap | 380 ns/op | 0 allocs/op | -| :zap: zap (sugared) | 564 ns/op | 2 allocs/op | -| zerolog | 321 ns/op | 0 allocs/op | -| lion | 7092 ns/op | 39 allocs/op | -| go-kit | 20226 ns/op | 115 allocs/op | -| logrus | 22312 ns/op | 130 allocs/op | -| log15 | 28788 ns/op | 79 allocs/op | -| apex/log | 42063 ns/op | 115 allocs/op | - -Log a static string, without any context or `printf`-style templating: - -| Package | Time | Objects Allocated | -| :--- | :---: | :---: | -| :zap: zap | 361 ns/op | 0 allocs/op | -| :zap: zap (sugared) | 534 ns/op | 2 allocs/op | -| zerolog | 323 ns/op | 0 allocs/op | -| standard library | 575 ns/op | 2 allocs/op | -| go-kit | 922 ns/op | 13 allocs/op | -| lion | 1413 ns/op | 10 allocs/op | -| logrus | 2291 ns/op | 27 allocs/op | -| apex/log | 3690 ns/op | 11 allocs/op | -| log15 | 5954 ns/op | 26 allocs/op | - -## Development Status: Stable - -All APIs are finalized, and no breaking changes will be made in the 1.x series -of releases. Users of semver-aware dependency management systems should pin -zap to `^1`. - -## Contributing - -We encourage and support an active, healthy community of contributors — -including you! Details are in the [contribution guide](CONTRIBUTING.md) and -the [code of conduct](CODE_OF_CONDUCT.md). The zap maintainers keep an eye on -issues and pull requests, but you can also report any negative conduct to -oss-conduct@uber.com. That email list is a private, safe space; even the zap -maintainers don't have access, so don't hesitate to hold us to a high -standard. - -
- -Released under the [MIT License](LICENSE.txt). - -1 In particular, keep in mind that we may be -benchmarking against slightly older versions of other packages. Versions are -pinned in zap's [glide.lock][] file. [↩](#anchor-versions) - -[doc-img]: https://godoc.org/go.uber.org/zap?status.svg -[doc]: https://godoc.org/go.uber.org/zap -[ci-img]: https://travis-ci.org/uber-go/zap.svg?branch=master -[ci]: https://travis-ci.org/uber-go/zap -[cov-img]: https://codecov.io/gh/uber-go/zap/branch/master/graph/badge.svg -[cov]: https://codecov.io/gh/uber-go/zap -[benchmarking suite]: https://github.com/uber-go/zap/tree/master/benchmarks -[glide.lock]: https://github.com/uber-go/zap/blob/master/glide.lock diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/array.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/array.go deleted file mode 100644 index 5be3704..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/array.go +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "time" - - "go.uber.org/zap/zapcore" -) - -// Array constructs a field with the given key and ArrayMarshaler. It provides -// a flexible, but still type-safe and efficient, way to add array-like types -// to the logging context. The struct's MarshalLogArray method is called lazily. -func Array(key string, val zapcore.ArrayMarshaler) Field { - return Field{Key: key, Type: zapcore.ArrayMarshalerType, Interface: val} -} - -// Bools constructs a field that carries a slice of bools. -func Bools(key string, bs []bool) Field { - return Array(key, bools(bs)) -} - -// ByteStrings constructs a field that carries a slice of []byte, each of which -// must be UTF-8 encoded text. -func ByteStrings(key string, bss [][]byte) Field { - return Array(key, byteStringsArray(bss)) -} - -// Complex128s constructs a field that carries a slice of complex numbers. -func Complex128s(key string, nums []complex128) Field { - return Array(key, complex128s(nums)) -} - -// Complex64s constructs a field that carries a slice of complex numbers. -func Complex64s(key string, nums []complex64) Field { - return Array(key, complex64s(nums)) -} - -// Durations constructs a field that carries a slice of time.Durations. -func Durations(key string, ds []time.Duration) Field { - return Array(key, durations(ds)) -} - -// Float64s constructs a field that carries a slice of floats. -func Float64s(key string, nums []float64) Field { - return Array(key, float64s(nums)) -} - -// Float32s constructs a field that carries a slice of floats. -func Float32s(key string, nums []float32) Field { - return Array(key, float32s(nums)) -} - -// Ints constructs a field that carries a slice of integers. -func Ints(key string, nums []int) Field { - return Array(key, ints(nums)) -} - -// Int64s constructs a field that carries a slice of integers. -func Int64s(key string, nums []int64) Field { - return Array(key, int64s(nums)) -} - -// Int32s constructs a field that carries a slice of integers. -func Int32s(key string, nums []int32) Field { - return Array(key, int32s(nums)) -} - -// Int16s constructs a field that carries a slice of integers. -func Int16s(key string, nums []int16) Field { - return Array(key, int16s(nums)) -} - -// Int8s constructs a field that carries a slice of integers. -func Int8s(key string, nums []int8) Field { - return Array(key, int8s(nums)) -} - -// Strings constructs a field that carries a slice of strings. -func Strings(key string, ss []string) Field { - return Array(key, stringArray(ss)) -} - -// Times constructs a field that carries a slice of time.Times. -func Times(key string, ts []time.Time) Field { - return Array(key, times(ts)) -} - -// Uints constructs a field that carries a slice of unsigned integers. -func Uints(key string, nums []uint) Field { - return Array(key, uints(nums)) -} - -// Uint64s constructs a field that carries a slice of unsigned integers. -func Uint64s(key string, nums []uint64) Field { - return Array(key, uint64s(nums)) -} - -// Uint32s constructs a field that carries a slice of unsigned integers. -func Uint32s(key string, nums []uint32) Field { - return Array(key, uint32s(nums)) -} - -// Uint16s constructs a field that carries a slice of unsigned integers. -func Uint16s(key string, nums []uint16) Field { - return Array(key, uint16s(nums)) -} - -// Uint8s constructs a field that carries a slice of unsigned integers. -func Uint8s(key string, nums []uint8) Field { - return Array(key, uint8s(nums)) -} - -// Uintptrs constructs a field that carries a slice of pointer addresses. -func Uintptrs(key string, us []uintptr) Field { - return Array(key, uintptrs(us)) -} - -// Errors constructs a field that carries a slice of errors. -func Errors(key string, errs []error) Field { - return Array(key, errArray(errs)) -} - -type bools []bool - -func (bs bools) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range bs { - arr.AppendBool(bs[i]) - } - return nil -} - -type byteStringsArray [][]byte - -func (bss byteStringsArray) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range bss { - arr.AppendByteString(bss[i]) - } - return nil -} - -type complex128s []complex128 - -func (nums complex128s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendComplex128(nums[i]) - } - return nil -} - -type complex64s []complex64 - -func (nums complex64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendComplex64(nums[i]) - } - return nil -} - -type durations []time.Duration - -func (ds durations) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range ds { - arr.AppendDuration(ds[i]) - } - return nil -} - -type float64s []float64 - -func (nums float64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendFloat64(nums[i]) - } - return nil -} - -type float32s []float32 - -func (nums float32s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendFloat32(nums[i]) - } - return nil -} - -type ints []int - -func (nums ints) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendInt(nums[i]) - } - return nil -} - -type int64s []int64 - -func (nums int64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendInt64(nums[i]) - } - return nil -} - -type int32s []int32 - -func (nums int32s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendInt32(nums[i]) - } - return nil -} - -type int16s []int16 - -func (nums int16s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendInt16(nums[i]) - } - return nil -} - -type int8s []int8 - -func (nums int8s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendInt8(nums[i]) - } - return nil -} - -type stringArray []string - -func (ss stringArray) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range ss { - arr.AppendString(ss[i]) - } - return nil -} - -type times []time.Time - -func (ts times) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range ts { - arr.AppendTime(ts[i]) - } - return nil -} - -type uints []uint - -func (nums uints) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendUint(nums[i]) - } - return nil -} - -type uint64s []uint64 - -func (nums uint64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendUint64(nums[i]) - } - return nil -} - -type uint32s []uint32 - -func (nums uint32s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendUint32(nums[i]) - } - return nil -} - -type uint16s []uint16 - -func (nums uint16s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendUint16(nums[i]) - } - return nil -} - -type uint8s []uint8 - -func (nums uint8s) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendUint8(nums[i]) - } - return nil -} - -type uintptrs []uintptr - -func (nums uintptrs) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range nums { - arr.AppendUintptr(nums[i]) - } - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/buffer/buffer.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/buffer/buffer.go deleted file mode 100644 index 7592e8c..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/buffer/buffer.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -// Package buffer provides a thin wrapper around a byte slice. Unlike the -// standard library's bytes.Buffer, it supports a portion of the strconv -// package's zero-allocation formatters. -package buffer // import "go.uber.org/zap/buffer" - -import "strconv" - -const _size = 1024 // by default, create 1 KiB buffers - -// Buffer is a thin wrapper around a byte slice. It's intended to be pooled, so -// the only way to construct one is via a Pool. -type Buffer struct { - bs []byte - pool Pool -} - -// AppendByte writes a single byte to the Buffer. -func (b *Buffer) AppendByte(v byte) { - b.bs = append(b.bs, v) -} - -// AppendString writes a string to the Buffer. -func (b *Buffer) AppendString(s string) { - b.bs = append(b.bs, s...) -} - -// AppendInt appends an integer to the underlying buffer (assuming base 10). -func (b *Buffer) AppendInt(i int64) { - b.bs = strconv.AppendInt(b.bs, i, 10) -} - -// AppendUint appends an unsigned integer to the underlying buffer (assuming -// base 10). -func (b *Buffer) AppendUint(i uint64) { - b.bs = strconv.AppendUint(b.bs, i, 10) -} - -// AppendBool appends a bool to the underlying buffer. -func (b *Buffer) AppendBool(v bool) { - b.bs = strconv.AppendBool(b.bs, v) -} - -// AppendFloat appends a float to the underlying buffer. It doesn't quote NaN -// or +/- Inf. -func (b *Buffer) AppendFloat(f float64, bitSize int) { - b.bs = strconv.AppendFloat(b.bs, f, 'f', -1, bitSize) -} - -// Len returns the length of the underlying byte slice. -func (b *Buffer) Len() int { - return len(b.bs) -} - -// Cap returns the capacity of the underlying byte slice. -func (b *Buffer) Cap() int { - return cap(b.bs) -} - -// Bytes returns a mutable reference to the underlying byte slice. -func (b *Buffer) Bytes() []byte { - return b.bs -} - -// String returns a string copy of the underlying byte slice. -func (b *Buffer) String() string { - return string(b.bs) -} - -// Reset resets the underlying byte slice. Subsequent writes re-use the slice's -// backing array. -func (b *Buffer) Reset() { - b.bs = b.bs[:0] -} - -// Write implements io.Writer. -func (b *Buffer) Write(bs []byte) (int, error) { - b.bs = append(b.bs, bs...) - return len(bs), nil -} - -// TrimNewline trims any final "\n" byte from the end of the buffer. -func (b *Buffer) TrimNewline() { - if i := len(b.bs) - 1; i >= 0 { - if b.bs[i] == '\n' { - b.bs = b.bs[:i] - } - } -} - -// Free returns the Buffer to its Pool. -// -// Callers must not retain references to the Buffer after calling Free. -func (b *Buffer) Free() { - b.pool.put(b) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/buffer/pool.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/buffer/pool.go deleted file mode 100644 index 8fb3e20..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/buffer/pool.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package buffer - -import "sync" - -// A Pool is a type-safe wrapper around a sync.Pool. -type Pool struct { - p *sync.Pool -} - -// NewPool constructs a new Pool. -func NewPool() Pool { - return Pool{p: &sync.Pool{ - New: func() interface{} { - return &Buffer{bs: make([]byte, 0, _size)} - }, - }} -} - -// Get retrieves a Buffer from the pool, creating one if necessary. -func (p Pool) Get() *Buffer { - buf := p.p.Get().(*Buffer) - buf.Reset() - buf.pool = p - return buf -} - -func (p Pool) put(buf *Buffer) { - p.p.Put(buf) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/check_license.sh b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/check_license.sh deleted file mode 100755 index 345ac8b..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/check_license.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -e - -ERROR_COUNT=0 -while read -r file -do - case "$(head -1 "${file}")" in - *"Copyright (c) "*" Uber Technologies, Inc.") - # everything's cool - ;; - *) - echo "$file is missing license header." - (( ERROR_COUNT++ )) - ;; - esac -done < <(git ls-files "*\.go") - -exit $ERROR_COUNT diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/config.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/config.go deleted file mode 100644 index 6fe17d9..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/config.go +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "sort" - "time" - - "go.uber.org/zap/zapcore" -) - -// SamplingConfig sets a sampling strategy for the logger. Sampling caps the -// global CPU and I/O load that logging puts on your process while attempting -// to preserve a representative subset of your logs. -// -// Values configured here are per-second. See zapcore.NewSampler for details. -type SamplingConfig struct { - Initial int `json:"initial" yaml:"initial"` - Thereafter int `json:"thereafter" yaml:"thereafter"` -} - -// Config offers a declarative way to construct a logger. It doesn't do -// anything that can't be done with New, Options, and the various -// zapcore.WriteSyncer and zapcore.Core wrappers, but it's a simpler way to -// toggle common options. -// -// Note that Config intentionally supports only the most common options. More -// unusual logging setups (logging to network connections or message queues, -// splitting output between multiple files, etc.) are possible, but require -// direct use of the zapcore package. For sample code, see the package-level -// BasicConfiguration and AdvancedConfiguration examples. -// -// For an example showing runtime log level changes, see the documentation for -// AtomicLevel. -type Config struct { - // Level is the minimum enabled logging level. Note that this is a dynamic - // level, so calling Config.Level.SetLevel will atomically change the log - // level of all loggers descended from this config. - Level AtomicLevel `json:"level" yaml:"level"` - // Development puts the logger in development mode, which changes the - // behavior of DPanicLevel and takes stacktraces more liberally. - Development bool `json:"development" yaml:"development"` - // DisableCaller stops annotating logs with the calling function's file - // name and line number. By default, all logs are annotated. - DisableCaller bool `json:"disableCaller" yaml:"disableCaller"` - // DisableStacktrace completely disables automatic stacktrace capturing. By - // default, stacktraces are captured for WarnLevel and above logs in - // development and ErrorLevel and above in production. - DisableStacktrace bool `json:"disableStacktrace" yaml:"disableStacktrace"` - // Sampling sets a sampling policy. A nil SamplingConfig disables sampling. - Sampling *SamplingConfig `json:"sampling" yaml:"sampling"` - // Encoding sets the logger's encoding. Valid values are "json" and - // "console", as well as any third-party encodings registered via - // RegisterEncoder. - Encoding string `json:"encoding" yaml:"encoding"` - // EncoderConfig sets options for the chosen encoder. See - // zapcore.EncoderConfig for details. - EncoderConfig zapcore.EncoderConfig `json:"encoderConfig" yaml:"encoderConfig"` - // OutputPaths is a list of URLs or file paths to write logging output to. - // See Open for details. - OutputPaths []string `json:"outputPaths" yaml:"outputPaths"` - // ErrorOutputPaths is a list of URLs to write internal logger errors to. - // The default is standard error. - // - // Note that this setting only affects internal errors; for sample code that - // sends error-level logs to a different location from info- and debug-level - // logs, see the package-level AdvancedConfiguration example. - ErrorOutputPaths []string `json:"errorOutputPaths" yaml:"errorOutputPaths"` - // InitialFields is a collection of fields to add to the root logger. - InitialFields map[string]interface{} `json:"initialFields" yaml:"initialFields"` -} - -// NewProductionEncoderConfig returns an opinionated EncoderConfig for -// production environments. -func NewProductionEncoderConfig() zapcore.EncoderConfig { - return zapcore.EncoderConfig{ - TimeKey: "ts", - LevelKey: "level", - NameKey: "logger", - CallerKey: "caller", - MessageKey: "msg", - StacktraceKey: "stacktrace", - LineEnding: zapcore.DefaultLineEnding, - EncodeLevel: zapcore.LowercaseLevelEncoder, - EncodeTime: zapcore.EpochTimeEncoder, - EncodeDuration: zapcore.SecondsDurationEncoder, - EncodeCaller: zapcore.ShortCallerEncoder, - } -} - -// NewProductionConfig is a reasonable production logging configuration. -// Logging is enabled at InfoLevel and above. -// -// It uses a JSON encoder, writes to standard error, and enables sampling. -// Stacktraces are automatically included on logs of ErrorLevel and above. -func NewProductionConfig() Config { - return Config{ - Level: NewAtomicLevelAt(InfoLevel), - Development: false, - Sampling: &SamplingConfig{ - Initial: 100, - Thereafter: 100, - }, - Encoding: "json", - EncoderConfig: NewProductionEncoderConfig(), - OutputPaths: []string{"stderr"}, - ErrorOutputPaths: []string{"stderr"}, - } -} - -// NewDevelopmentEncoderConfig returns an opinionated EncoderConfig for -// development environments. -func NewDevelopmentEncoderConfig() zapcore.EncoderConfig { - return zapcore.EncoderConfig{ - // Keys can be anything except the empty string. - TimeKey: "T", - LevelKey: "L", - NameKey: "N", - CallerKey: "C", - MessageKey: "M", - StacktraceKey: "S", - LineEnding: zapcore.DefaultLineEnding, - EncodeLevel: zapcore.CapitalLevelEncoder, - EncodeTime: zapcore.ISO8601TimeEncoder, - EncodeDuration: zapcore.StringDurationEncoder, - EncodeCaller: zapcore.ShortCallerEncoder, - } -} - -// NewDevelopmentConfig is a reasonable development logging configuration. -// Logging is enabled at DebugLevel and above. -// -// It enables development mode (which makes DPanicLevel logs panic), uses a -// console encoder, writes to standard error, and disables sampling. -// Stacktraces are automatically included on logs of WarnLevel and above. -func NewDevelopmentConfig() Config { - return Config{ - Level: NewAtomicLevelAt(DebugLevel), - Development: true, - Encoding: "console", - EncoderConfig: NewDevelopmentEncoderConfig(), - OutputPaths: []string{"stderr"}, - ErrorOutputPaths: []string{"stderr"}, - } -} - -// Build constructs a logger from the Config and Options. -func (cfg Config) Build(opts ...Option) (*Logger, error) { - enc, err := cfg.buildEncoder() - if err != nil { - return nil, err - } - - sink, errSink, err := cfg.openSinks() - if err != nil { - return nil, err - } - - log := New( - zapcore.NewCore(enc, sink, cfg.Level), - cfg.buildOptions(errSink)..., - ) - if len(opts) > 0 { - log = log.WithOptions(opts...) - } - return log, nil -} - -func (cfg Config) buildOptions(errSink zapcore.WriteSyncer) []Option { - opts := []Option{ErrorOutput(errSink)} - - if cfg.Development { - opts = append(opts, Development()) - } - - if !cfg.DisableCaller { - opts = append(opts, AddCaller()) - } - - stackLevel := ErrorLevel - if cfg.Development { - stackLevel = WarnLevel - } - if !cfg.DisableStacktrace { - opts = append(opts, AddStacktrace(stackLevel)) - } - - if cfg.Sampling != nil { - opts = append(opts, WrapCore(func(core zapcore.Core) zapcore.Core { - return zapcore.NewSampler(core, time.Second, int(cfg.Sampling.Initial), int(cfg.Sampling.Thereafter)) - })) - } - - if len(cfg.InitialFields) > 0 { - fs := make([]Field, 0, len(cfg.InitialFields)) - keys := make([]string, 0, len(cfg.InitialFields)) - for k := range cfg.InitialFields { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - fs = append(fs, Any(k, cfg.InitialFields[k])) - } - opts = append(opts, Fields(fs...)) - } - - return opts -} - -func (cfg Config) openSinks() (zapcore.WriteSyncer, zapcore.WriteSyncer, error) { - sink, closeOut, err := Open(cfg.OutputPaths...) - if err != nil { - return nil, nil, err - } - errSink, _, err := Open(cfg.ErrorOutputPaths...) - if err != nil { - closeOut() - return nil, nil, err - } - return sink, errSink, nil -} - -func (cfg Config) buildEncoder() (zapcore.Encoder, error) { - return newEncoder(cfg.Encoding, cfg.EncoderConfig) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/doc.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/doc.go deleted file mode 100644 index 8638dd1..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/doc.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -// Package zap provides fast, structured, leveled logging. -// -// For applications that log in the hot path, reflection-based serialization -// and string formatting are prohibitively expensive - they're CPU-intensive -// and make many small allocations. Put differently, using json.Marshal and -// fmt.Fprintf to log tons of interface{} makes your application slow. -// -// Zap takes a different approach. It includes a reflection-free, -// zero-allocation JSON encoder, and the base Logger strives to avoid -// serialization overhead and allocations wherever possible. By building the -// high-level SugaredLogger on that foundation, zap lets users choose when -// they need to count every allocation and when they'd prefer a more familiar, -// loosely typed API. -// -// Choosing a Logger -// -// In contexts where performance is nice, but not critical, use the -// SugaredLogger. It's 4-10x faster than other structured logging packages and -// supports both structured and printf-style logging. Like log15 and go-kit, -// the SugaredLogger's structured logging APIs are loosely typed and accept a -// variadic number of key-value pairs. (For more advanced use cases, they also -// accept strongly typed fields - see the SugaredLogger.With documentation for -// details.) -// sugar := zap.NewExample().Sugar() -// defer sugar.Sync() -// sugar.Infow("failed to fetch URL", -// "url", "http://example.com", -// "attempt", 3, -// "backoff", time.Second, -// ) -// sugar.Infof("failed to fetch URL: %s", "http://example.com") -// -// By default, loggers are unbuffered. However, since zap's low-level APIs -// allow buffering, calling Sync before letting your process exit is a good -// habit. -// -// In the rare contexts where every microsecond and every allocation matter, -// use the Logger. It's even faster than the SugaredLogger and allocates far -// less, but it only supports strongly-typed, structured logging. -// logger := zap.NewExample() -// defer logger.Sync() -// logger.Info("failed to fetch URL", -// zap.String("url", "http://example.com"), -// zap.Int("attempt", 3), -// zap.Duration("backoff", time.Second), -// ) -// -// Choosing between the Logger and SugaredLogger doesn't need to be an -// application-wide decision: converting between the two is simple and -// inexpensive. -// logger := zap.NewExample() -// defer logger.Sync() -// sugar := logger.Sugar() -// plain := sugar.Desugar() -// -// Configuring Zap -// -// The simplest way to build a Logger is to use zap's opinionated presets: -// NewExample, NewProduction, and NewDevelopment. These presets build a logger -// with a single function call: -// logger, err := zap.NewProduction() -// if err != nil { -// log.Fatalf("can't initialize zap logger: %v", err) -// } -// defer logger.Sync() -// -// Presets are fine for small projects, but larger projects and organizations -// naturally require a bit more customization. For most users, zap's Config -// struct strikes the right balance between flexibility and convenience. See -// the package-level BasicConfiguration example for sample code. -// -// More unusual configurations (splitting output between files, sending logs -// to a message queue, etc.) are possible, but require direct use of -// go.uber.org/zap/zapcore. See the package-level AdvancedConfiguration -// example for sample code. -// -// Extending Zap -// -// The zap package itself is a relatively thin wrapper around the interfaces -// in go.uber.org/zap/zapcore. Extending zap to support a new encoding (e.g., -// BSON), a new log sink (e.g., Kafka), or something more exotic (perhaps an -// exception aggregation service, like Sentry or Rollbar) typically requires -// implementing the zapcore.Encoder, zapcore.WriteSyncer, or zapcore.Core -// interfaces. See the zapcore documentation for details. -// -// Similarly, package authors can use the high-performance Encoder and Core -// implementations in the zapcore package to build their own loggers. -// -// Frequently Asked Questions -// -// An FAQ covering everything from installation errors to design decisions is -// available at https://github.com/uber-go/zap/blob/master/FAQ.md. -package zap // import "go.uber.org/zap" diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/encoder.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/encoder.go deleted file mode 100644 index 2e9d3c3..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/encoder.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "errors" - "fmt" - "sync" - - "go.uber.org/zap/zapcore" -) - -var ( - errNoEncoderNameSpecified = errors.New("no encoder name specified") - - _encoderNameToConstructor = map[string]func(zapcore.EncoderConfig) (zapcore.Encoder, error){ - "console": func(encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { - return zapcore.NewConsoleEncoder(encoderConfig), nil - }, - "json": func(encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { - return zapcore.NewJSONEncoder(encoderConfig), nil - }, - } - _encoderMutex sync.RWMutex -) - -// RegisterEncoder registers an encoder constructor, which the Config struct -// can then reference. By default, the "json" and "console" encoders are -// registered. -// -// Attempting to register an encoder whose name is already taken returns an -// error. -func RegisterEncoder(name string, constructor func(zapcore.EncoderConfig) (zapcore.Encoder, error)) error { - _encoderMutex.Lock() - defer _encoderMutex.Unlock() - if name == "" { - return errNoEncoderNameSpecified - } - if _, ok := _encoderNameToConstructor[name]; ok { - return fmt.Errorf("encoder already registered for name %q", name) - } - _encoderNameToConstructor[name] = constructor - return nil -} - -func newEncoder(name string, encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { - _encoderMutex.RLock() - defer _encoderMutex.RUnlock() - if name == "" { - return nil, errNoEncoderNameSpecified - } - constructor, ok := _encoderNameToConstructor[name] - if !ok { - return nil, fmt.Errorf("no encoder registered for name %q", name) - } - return constructor(encoderConfig) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/error.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/error.go deleted file mode 100644 index 65982a5..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/error.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2017 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "sync" - - "go.uber.org/zap/zapcore" -) - -var _errArrayElemPool = sync.Pool{New: func() interface{} { - return &errArrayElem{} -}} - -// Error is shorthand for the common idiom NamedError("error", err). -func Error(err error) Field { - return NamedError("error", err) -} - -// NamedError constructs a field that lazily stores err.Error() under the -// provided key. Errors which also implement fmt.Formatter (like those produced -// by github.com/pkg/errors) will also have their verbose representation stored -// under key+"Verbose". If passed a nil error, the field is a no-op. -// -// For the common case in which the key is simply "error", the Error function -// is shorter and less repetitive. -func NamedError(key string, err error) Field { - if err == nil { - return Skip() - } - return Field{Key: key, Type: zapcore.ErrorType, Interface: err} -} - -type errArray []error - -func (errs errArray) MarshalLogArray(arr zapcore.ArrayEncoder) error { - for i := range errs { - if errs[i] == nil { - continue - } - // To represent each error as an object with an "error" attribute and - // potentially an "errorVerbose" attribute, we need to wrap it in a - // type that implements LogObjectMarshaler. To prevent this from - // allocating, pool the wrapper type. - elem := _errArrayElemPool.Get().(*errArrayElem) - elem.error = errs[i] - arr.AppendObject(elem) - elem.error = nil - _errArrayElemPool.Put(elem) - } - return nil -} - -type errArrayElem struct { - error -} - -func (e *errArrayElem) MarshalLogObject(enc zapcore.ObjectEncoder) error { - // Re-use the error field's logic, which supports non-standard error types. - Error(e.error).AddTo(enc) - return nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/field.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/field.go deleted file mode 100644 index 5130e13..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/field.go +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "fmt" - "math" - "time" - - "go.uber.org/zap/zapcore" -) - -// Field is an alias for Field. Aliasing this type dramatically -// improves the navigability of this package's API documentation. -type Field = zapcore.Field - -// Skip constructs a no-op field, which is often useful when handling invalid -// inputs in other Field constructors. -func Skip() Field { - return Field{Type: zapcore.SkipType} -} - -// Binary constructs a field that carries an opaque binary blob. -// -// Binary data is serialized in an encoding-appropriate format. For example, -// zap's JSON encoder base64-encodes binary blobs. To log UTF-8 encoded text, -// use ByteString. -func Binary(key string, val []byte) Field { - return Field{Key: key, Type: zapcore.BinaryType, Interface: val} -} - -// Bool constructs a field that carries a bool. -func Bool(key string, val bool) Field { - var ival int64 - if val { - ival = 1 - } - return Field{Key: key, Type: zapcore.BoolType, Integer: ival} -} - -// ByteString constructs a field that carries UTF-8 encoded text as a []byte. -// To log opaque binary blobs (which aren't necessarily valid UTF-8), use -// Binary. -func ByteString(key string, val []byte) Field { - return Field{Key: key, Type: zapcore.ByteStringType, Interface: val} -} - -// Complex128 constructs a field that carries a complex number. Unlike most -// numeric fields, this costs an allocation (to convert the complex128 to -// interface{}). -func Complex128(key string, val complex128) Field { - return Field{Key: key, Type: zapcore.Complex128Type, Interface: val} -} - -// Complex64 constructs a field that carries a complex number. Unlike most -// numeric fields, this costs an allocation (to convert the complex64 to -// interface{}). -func Complex64(key string, val complex64) Field { - return Field{Key: key, Type: zapcore.Complex64Type, Interface: val} -} - -// Float64 constructs a field that carries a float64. The way the -// floating-point value is represented is encoder-dependent, so marshaling is -// necessarily lazy. -func Float64(key string, val float64) Field { - return Field{Key: key, Type: zapcore.Float64Type, Integer: int64(math.Float64bits(val))} -} - -// Float32 constructs a field that carries a float32. The way the -// floating-point value is represented is encoder-dependent, so marshaling is -// necessarily lazy. -func Float32(key string, val float32) Field { - return Field{Key: key, Type: zapcore.Float32Type, Integer: int64(math.Float32bits(val))} -} - -// Int constructs a field with the given key and value. -func Int(key string, val int) Field { - return Int64(key, int64(val)) -} - -// Int64 constructs a field with the given key and value. -func Int64(key string, val int64) Field { - return Field{Key: key, Type: zapcore.Int64Type, Integer: val} -} - -// Int32 constructs a field with the given key and value. -func Int32(key string, val int32) Field { - return Field{Key: key, Type: zapcore.Int32Type, Integer: int64(val)} -} - -// Int16 constructs a field with the given key and value. -func Int16(key string, val int16) Field { - return Field{Key: key, Type: zapcore.Int16Type, Integer: int64(val)} -} - -// Int8 constructs a field with the given key and value. -func Int8(key string, val int8) Field { - return Field{Key: key, Type: zapcore.Int8Type, Integer: int64(val)} -} - -// String constructs a field with the given key and value. -func String(key string, val string) Field { - return Field{Key: key, Type: zapcore.StringType, String: val} -} - -// Uint constructs a field with the given key and value. -func Uint(key string, val uint) Field { - return Uint64(key, uint64(val)) -} - -// Uint64 constructs a field with the given key and value. -func Uint64(key string, val uint64) Field { - return Field{Key: key, Type: zapcore.Uint64Type, Integer: int64(val)} -} - -// Uint32 constructs a field with the given key and value. -func Uint32(key string, val uint32) Field { - return Field{Key: key, Type: zapcore.Uint32Type, Integer: int64(val)} -} - -// Uint16 constructs a field with the given key and value. -func Uint16(key string, val uint16) Field { - return Field{Key: key, Type: zapcore.Uint16Type, Integer: int64(val)} -} - -// Uint8 constructs a field with the given key and value. -func Uint8(key string, val uint8) Field { - return Field{Key: key, Type: zapcore.Uint8Type, Integer: int64(val)} -} - -// Uintptr constructs a field with the given key and value. -func Uintptr(key string, val uintptr) Field { - return Field{Key: key, Type: zapcore.UintptrType, Integer: int64(val)} -} - -// Reflect constructs a field with the given key and an arbitrary object. It uses -// an encoding-appropriate, reflection-based function to lazily serialize nearly -// any object into the logging context, but it's relatively slow and -// allocation-heavy. Outside tests, Any is always a better choice. -// -// If encoding fails (e.g., trying to serialize a map[int]string to JSON), Reflect -// includes the error message in the final log output. -func Reflect(key string, val interface{}) Field { - return Field{Key: key, Type: zapcore.ReflectType, Interface: val} -} - -// Namespace creates a named, isolated scope within the logger's context. All -// subsequent fields will be added to the new namespace. -// -// This helps prevent key collisions when injecting loggers into sub-components -// or third-party libraries. -func Namespace(key string) Field { - return Field{Key: key, Type: zapcore.NamespaceType} -} - -// Stringer constructs a field with the given key and the output of the value's -// String method. The Stringer's String method is called lazily. -func Stringer(key string, val fmt.Stringer) Field { - return Field{Key: key, Type: zapcore.StringerType, Interface: val} -} - -// Time constructs a Field with the given key and value. The encoder -// controls how the time is serialized. -func Time(key string, val time.Time) Field { - return Field{Key: key, Type: zapcore.TimeType, Integer: val.UnixNano(), Interface: val.Location()} -} - -// Stack constructs a field that stores a stacktrace of the current goroutine -// under provided key. Keep in mind that taking a stacktrace is eager and -// expensive (relatively speaking); this function both makes an allocation and -// takes about two microseconds. -func Stack(key string) Field { - // Returning the stacktrace as a string costs an allocation, but saves us - // from expanding the zapcore.Field union struct to include a byte slice. Since - // taking a stacktrace is already so expensive (~10us), the extra allocation - // is okay. - return String(key, takeStacktrace()) -} - -// Duration constructs a field with the given key and value. The encoder -// controls how the duration is serialized. -func Duration(key string, val time.Duration) Field { - return Field{Key: key, Type: zapcore.DurationType, Integer: int64(val)} -} - -// Object constructs a field with the given key and ObjectMarshaler. It -// provides a flexible, but still type-safe and efficient, way to add map- or -// struct-like user-defined types to the logging context. The struct's -// MarshalLogObject method is called lazily. -func Object(key string, val zapcore.ObjectMarshaler) Field { - return Field{Key: key, Type: zapcore.ObjectMarshalerType, Interface: val} -} - -// Any takes a key and an arbitrary value and chooses the best way to represent -// them as a field, falling back to a reflection-based approach only if -// necessary. -// -// Since byte/uint8 and rune/int32 are aliases, Any can't differentiate between -// them. To minimize surprises, []byte values are treated as binary blobs, byte -// values are treated as uint8, and runes are always treated as integers. -func Any(key string, value interface{}) Field { - switch val := value.(type) { - case zapcore.ObjectMarshaler: - return Object(key, val) - case zapcore.ArrayMarshaler: - return Array(key, val) - case bool: - return Bool(key, val) - case []bool: - return Bools(key, val) - case complex128: - return Complex128(key, val) - case []complex128: - return Complex128s(key, val) - case complex64: - return Complex64(key, val) - case []complex64: - return Complex64s(key, val) - case float64: - return Float64(key, val) - case []float64: - return Float64s(key, val) - case float32: - return Float32(key, val) - case []float32: - return Float32s(key, val) - case int: - return Int(key, val) - case []int: - return Ints(key, val) - case int64: - return Int64(key, val) - case []int64: - return Int64s(key, val) - case int32: - return Int32(key, val) - case []int32: - return Int32s(key, val) - case int16: - return Int16(key, val) - case []int16: - return Int16s(key, val) - case int8: - return Int8(key, val) - case []int8: - return Int8s(key, val) - case string: - return String(key, val) - case []string: - return Strings(key, val) - case uint: - return Uint(key, val) - case []uint: - return Uints(key, val) - case uint64: - return Uint64(key, val) - case []uint64: - return Uint64s(key, val) - case uint32: - return Uint32(key, val) - case []uint32: - return Uint32s(key, val) - case uint16: - return Uint16(key, val) - case []uint16: - return Uint16s(key, val) - case uint8: - return Uint8(key, val) - case []byte: - return Binary(key, val) - case uintptr: - return Uintptr(key, val) - case []uintptr: - return Uintptrs(key, val) - case time.Time: - return Time(key, val) - case []time.Time: - return Times(key, val) - case time.Duration: - return Duration(key, val) - case []time.Duration: - return Durations(key, val) - case error: - return NamedError(key, val) - case []error: - return Errors(key, val) - case fmt.Stringer: - return Stringer(key, val) - default: - return Reflect(key, val) - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/flag.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/flag.go deleted file mode 100644 index 1312875..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/flag.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "flag" - - "go.uber.org/zap/zapcore" -) - -// LevelFlag uses the standard library's flag.Var to declare a global flag -// with the specified name, default, and usage guidance. The returned value is -// a pointer to the value of the flag. -// -// If you don't want to use the flag package's global state, you can use any -// non-nil *Level as a flag.Value with your own *flag.FlagSet. -func LevelFlag(name string, defaultLevel zapcore.Level, usage string) *zapcore.Level { - lvl := defaultLevel - flag.Var(&lvl, name, usage) - return &lvl -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/glide.lock b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/glide.lock deleted file mode 100644 index 881b462..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/glide.lock +++ /dev/null @@ -1,76 +0,0 @@ -hash: f073ba522c06c88ea3075bde32a8aaf0969a840a66cab6318a0897d141ffee92 -updated: 2017-07-22T18:06:49.598185334-07:00 -imports: -- name: go.uber.org/atomic - version: 4e336646b2ef9fc6e47be8e21594178f98e5ebcf -- name: go.uber.org/multierr - version: 3c4937480c32f4c13a875a1829af76c98ca3d40a -testImports: -- name: github.com/apex/log - version: d9b960447bfa720077b2da653cc79e533455b499 - subpackages: - - handlers/json -- name: github.com/axw/gocov - version: 3a69a0d2a4ef1f263e2d92b041a69593d6964fe8 - subpackages: - - gocov -- name: github.com/davecgh/go-spew - version: 04cdfd42973bb9c8589fd6a731800cf222fde1a9 - subpackages: - - spew -- name: github.com/fatih/color - version: 62e9147c64a1ed519147b62a56a14e83e2be02c1 -- name: github.com/go-kit/kit - version: e10f5bf035be9af21fd5b2fb4469d5716c6ab07d - subpackages: - - log -- name: github.com/go-logfmt/logfmt - version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5 -- name: github.com/go-stack/stack - version: 54be5f394ed2c3e19dac9134a40a95ba5a017f7b -- name: github.com/golang/lint - version: c5fb716d6688a859aae56d26d3e6070808df29f7 - subpackages: - - golint -- name: github.com/kr/logfmt - version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0 -- name: github.com/mattn/go-colorable - version: 3fa8c76f9daed4067e4a806fb7e4dc86455c6d6a -- name: github.com/mattn/go-isatty - version: fc9e8d8ef48496124e79ae0df75490096eccf6fe -- name: github.com/mattn/goveralls - version: 6efce81852ad1b7567c17ad71b03aeccc9dd9ae0 -- name: github.com/pborman/uuid - version: e790cca94e6cc75c7064b1332e63811d4aae1a53 -- name: github.com/pkg/errors - version: 645ef00459ed84a119197bfb8d8205042c6df63d -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/rs/zerolog - version: eed4c2b94d945e0b2456ad6aa518a443986b5f22 -- name: github.com/satori/go.uuid - version: 5bf94b69c6b68ee1b541973bb8e1144db23a194b -- name: github.com/sirupsen/logrus - version: 7dd06bf38e1e13df288d471a57d5adbac106be9e -- name: github.com/stretchr/testify - version: f6abca593680b2315d2075e0f5e2a9751e3f431a - subpackages: - - assert - - require -- name: go.pedge.io/lion - version: 87958e8713f1fa138d993087133b97e976642159 -- name: golang.org/x/sys - version: c4489faa6e5ab84c0ef40d6ee878f7a030281f0f - subpackages: - - unix -- name: golang.org/x/tools - version: 496819729719f9d07692195e0a94d6edd2251389 - subpackages: - - cover -- name: gopkg.in/inconshreveable/log15.v2 - version: b105bd37f74e5d9dc7b6ad7806715c7a2b83fd3f - subpackages: - - stack - - term diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/glide.yaml b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/glide.yaml deleted file mode 100644 index 9441259..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/glide.yaml +++ /dev/null @@ -1,35 +0,0 @@ -package: go.uber.org/zap -license: MIT -import: -- package: go.uber.org/atomic - version: ^1 -- package: go.uber.org/multierr - version: ^1 -testImport: -- package: github.com/satori/go.uuid -- package: github.com/sirupsen/logrus -- package: github.com/apex/log - subpackages: - - handlers/json -- package: github.com/go-kit/kit - subpackages: - - log -- package: github.com/stretchr/testify - subpackages: - - assert - - require -- package: gopkg.in/inconshreveable/log15.v2 -- package: github.com/mattn/goveralls -- package: github.com/pborman/uuid -- package: github.com/pkg/errors -- package: go.pedge.io/lion -- package: github.com/rs/zerolog -- package: golang.org/x/tools - subpackages: - - cover -- package: github.com/golang/lint - subpackages: - - golint -- package: github.com/axw/gocov - subpackages: - - gocov diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/global.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/global.go deleted file mode 100644 index d02232e..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/global.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "bytes" - "fmt" - "log" - "os" - "sync" - - "go.uber.org/zap/zapcore" -) - -const ( - _stdLogDefaultDepth = 2 - _loggerWriterDepth = 2 - _programmerErrorTemplate = "You've found a bug in zap! Please file a bug at " + - "https://github.com/uber-go/zap/issues/new and reference this error: %v" -) - -var ( - _globalMu sync.RWMutex - _globalL = NewNop() - _globalS = _globalL.Sugar() -) - -// L returns the global Logger, which can be reconfigured with ReplaceGlobals. -// It's safe for concurrent use. -func L() *Logger { - _globalMu.RLock() - l := _globalL - _globalMu.RUnlock() - return l -} - -// S returns the global SugaredLogger, which can be reconfigured with -// ReplaceGlobals. It's safe for concurrent use. -func S() *SugaredLogger { - _globalMu.RLock() - s := _globalS - _globalMu.RUnlock() - return s -} - -// ReplaceGlobals replaces the global Logger and SugaredLogger, and returns a -// function to restore the original values. It's safe for concurrent use. -func ReplaceGlobals(logger *Logger) func() { - _globalMu.Lock() - prev := _globalL - _globalL = logger - _globalS = logger.Sugar() - _globalMu.Unlock() - return func() { ReplaceGlobals(prev) } -} - -// NewStdLog returns a *log.Logger which writes to the supplied zap Logger at -// InfoLevel. To redirect the standard library's package-global logging -// functions, use RedirectStdLog instead. -func NewStdLog(l *Logger) *log.Logger { - logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) - f := logger.Info - return log.New(&loggerWriter{f}, "" /* prefix */, 0 /* flags */) -} - -// NewStdLogAt returns *log.Logger which writes to supplied zap logger at -// required level. -func NewStdLogAt(l *Logger, level zapcore.Level) (*log.Logger, error) { - logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) - logFunc, err := levelToFunc(logger, level) - if err != nil { - return nil, err - } - return log.New(&loggerWriter{logFunc}, "" /* prefix */, 0 /* flags */), nil -} - -// RedirectStdLog redirects output from the standard library's package-global -// logger to the supplied logger at InfoLevel. Since zap already handles caller -// annotations, timestamps, etc., it automatically disables the standard -// library's annotations and prefixing. -// -// It returns a function to restore the original prefix and flags and reset the -// standard library's output to os.Stderr. -func RedirectStdLog(l *Logger) func() { - f, err := redirectStdLogAt(l, InfoLevel) - if err != nil { - // Can't get here, since passing InfoLevel to redirectStdLogAt always - // works. - panic(fmt.Sprintf(_programmerErrorTemplate, err)) - } - return f -} - -// RedirectStdLogAt redirects output from the standard library's package-global -// logger to the supplied logger at the specified level. Since zap already -// handles caller annotations, timestamps, etc., it automatically disables the -// standard library's annotations and prefixing. -// -// It returns a function to restore the original prefix and flags and reset the -// standard library's output to os.Stderr. -func RedirectStdLogAt(l *Logger, level zapcore.Level) (func(), error) { - return redirectStdLogAt(l, level) -} - -func redirectStdLogAt(l *Logger, level zapcore.Level) (func(), error) { - flags := log.Flags() - prefix := log.Prefix() - log.SetFlags(0) - log.SetPrefix("") - logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) - logFunc, err := levelToFunc(logger, level) - if err != nil { - return nil, err - } - log.SetOutput(&loggerWriter{logFunc}) - return func() { - log.SetFlags(flags) - log.SetPrefix(prefix) - log.SetOutput(os.Stderr) - }, nil -} - -func levelToFunc(logger *Logger, lvl zapcore.Level) (func(string, ...Field), error) { - switch lvl { - case DebugLevel: - return logger.Debug, nil - case InfoLevel: - return logger.Info, nil - case WarnLevel: - return logger.Warn, nil - case ErrorLevel: - return logger.Error, nil - case DPanicLevel: - return logger.DPanic, nil - case PanicLevel: - return logger.Panic, nil - case FatalLevel: - return logger.Fatal, nil - } - return nil, fmt.Errorf("unrecognized level: %q", lvl) -} - -type loggerWriter struct { - logFunc func(msg string, fields ...Field) -} - -func (l *loggerWriter) Write(p []byte) (int, error) { - p = bytes.TrimSpace(p) - l.logFunc(string(p)) - return len(p), nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/http_handler.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/http_handler.go deleted file mode 100644 index 1b0ecac..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/http_handler.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "encoding/json" - "fmt" - "net/http" - - "go.uber.org/zap/zapcore" -) - -// ServeHTTP is a simple JSON endpoint that can report on or change the current -// logging level. -// -// GET requests return a JSON description of the current logging level. PUT -// requests change the logging level and expect a payload like: -// {"level":"info"} -// -// It's perfectly safe to change the logging level while a program is running. -func (lvl AtomicLevel) ServeHTTP(w http.ResponseWriter, r *http.Request) { - type errorResponse struct { - Error string `json:"error"` - } - type payload struct { - Level *zapcore.Level `json:"level"` - } - - enc := json.NewEncoder(w) - - switch r.Method { - - case http.MethodGet: - current := lvl.Level() - enc.Encode(payload{Level: ¤t}) - - case http.MethodPut: - var req payload - - if errmess := func() string { - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - return fmt.Sprintf("Request body must be well-formed JSON: %v", err) - } - if req.Level == nil { - return "Must specify a logging level." - } - return "" - }(); errmess != "" { - w.WriteHeader(http.StatusBadRequest) - enc.Encode(errorResponse{Error: errmess}) - return - } - - lvl.SetLevel(*req.Level) - enc.Encode(req) - - default: - w.WriteHeader(http.StatusMethodNotAllowed) - enc.Encode(errorResponse{ - Error: "Only GET and PUT are supported.", - }) - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go deleted file mode 100644 index dad583a..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -// Package bufferpool houses zap's shared internal buffer pool. Third-party -// packages can recreate the same functionality with buffers.NewPool. -package bufferpool - -import "go.uber.org/zap/buffer" - -var ( - _pool = buffer.NewPool() - // Get retrieves a buffer from the pool, creating one if necessary. - Get = _pool.Get -) diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/color/color.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/color/color.go deleted file mode 100644 index c4d5d02..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/color/color.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -// Package color adds coloring functionality for TTY output. -package color - -import "fmt" - -// Foreground colors. -const ( - Black Color = iota + 30 - Red - Green - Yellow - Blue - Magenta - Cyan - White -) - -// Color represents a text color. -type Color uint8 - -// Add adds the coloring to the given string. -func (c Color) Add(s string) string { - return fmt.Sprintf("\x1b[%dm%s\x1b[0m", uint8(c), s) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/exit/exit.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/exit/exit.go deleted file mode 100644 index dfc5b05..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/internal/exit/exit.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -// Package exit provides stubs so that unit tests can exercise code that calls -// os.Exit(1). -package exit - -import "os" - -var real = func() { os.Exit(1) } - -// Exit normally terminates the process by calling os.Exit(1). If the package -// is stubbed, it instead records a call in the testing spy. -func Exit() { - real() -} - -// A StubbedExit is a testing fake for os.Exit. -type StubbedExit struct { - Exited bool - prev func() -} - -// Stub substitutes a fake for the call to os.Exit(1). -func Stub() *StubbedExit { - s := &StubbedExit{prev: real} - real = s.exit - return s -} - -// WithStub runs the supplied function with Exit stubbed. It returns the stub -// used, so that users can test whether the process would have crashed. -func WithStub(f func()) *StubbedExit { - s := Stub() - defer s.Unstub() - f() - return s -} - -// Unstub restores the previous exit function. -func (se *StubbedExit) Unstub() { - real = se.prev -} - -func (se *StubbedExit) exit() { - se.Exited = true -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/level.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/level.go deleted file mode 100644 index 3567a9a..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/level.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "go.uber.org/atomic" - "go.uber.org/zap/zapcore" -) - -const ( - // DebugLevel logs are typically voluminous, and are usually disabled in - // production. - DebugLevel = zapcore.DebugLevel - // InfoLevel is the default logging priority. - InfoLevel = zapcore.InfoLevel - // WarnLevel logs are more important than Info, but don't need individual - // human review. - WarnLevel = zapcore.WarnLevel - // ErrorLevel logs are high-priority. If an application is running smoothly, - // it shouldn't generate any error-level logs. - ErrorLevel = zapcore.ErrorLevel - // DPanicLevel logs are particularly important errors. In development the - // logger panics after writing the message. - DPanicLevel = zapcore.DPanicLevel - // PanicLevel logs a message, then panics. - PanicLevel = zapcore.PanicLevel - // FatalLevel logs a message, then calls os.Exit(1). - FatalLevel = zapcore.FatalLevel -) - -// LevelEnablerFunc is a convenient way to implement zapcore.LevelEnabler with -// an anonymous function. -// -// It's particularly useful when splitting log output between different -// outputs (e.g., standard error and standard out). For sample code, see the -// package-level AdvancedConfiguration example. -type LevelEnablerFunc func(zapcore.Level) bool - -// Enabled calls the wrapped function. -func (f LevelEnablerFunc) Enabled(lvl zapcore.Level) bool { return f(lvl) } - -// An AtomicLevel is an atomically changeable, dynamic logging level. It lets -// you safely change the log level of a tree of loggers (the root logger and -// any children created by adding context) at runtime. -// -// The AtomicLevel itself is an http.Handler that serves a JSON endpoint to -// alter its level. -// -// AtomicLevels must be created with the NewAtomicLevel constructor to allocate -// their internal atomic pointer. -type AtomicLevel struct { - l *atomic.Int32 -} - -// NewAtomicLevel creates an AtomicLevel with InfoLevel and above logging -// enabled. -func NewAtomicLevel() AtomicLevel { - return AtomicLevel{ - l: atomic.NewInt32(int32(InfoLevel)), - } -} - -// NewAtomicLevelAt is a convenience function that creates an AtomicLevel -// and then calls SetLevel with the given level. -func NewAtomicLevelAt(l zapcore.Level) AtomicLevel { - a := NewAtomicLevel() - a.SetLevel(l) - return a -} - -// Enabled implements the zapcore.LevelEnabler interface, which allows the -// AtomicLevel to be used in place of traditional static levels. -func (lvl AtomicLevel) Enabled(l zapcore.Level) bool { - return lvl.Level().Enabled(l) -} - -// Level returns the minimum enabled log level. -func (lvl AtomicLevel) Level() zapcore.Level { - return zapcore.Level(int8(lvl.l.Load())) -} - -// SetLevel alters the logging level. -func (lvl AtomicLevel) SetLevel(l zapcore.Level) { - lvl.l.Store(int32(l)) -} - -// String returns the string representation of the underlying Level. -func (lvl AtomicLevel) String() string { - return lvl.Level().String() -} - -// UnmarshalText unmarshals the text to an AtomicLevel. It uses the same text -// representations as the static zapcore.Levels ("debug", "info", "warn", -// "error", "dpanic", "panic", and "fatal"). -func (lvl *AtomicLevel) UnmarshalText(text []byte) error { - if lvl.l == nil { - lvl.l = &atomic.Int32{} - } - - var l zapcore.Level - if err := l.UnmarshalText(text); err != nil { - return err - } - - lvl.SetLevel(l) - return nil -} - -// MarshalText marshals the AtomicLevel to a byte slice. It uses the same -// text representation as the static zapcore.Levels ("debug", "info", "warn", -// "error", "dpanic", "panic", and "fatal"). -func (lvl AtomicLevel) MarshalText() (text []byte, err error) { - return lvl.Level().MarshalText() -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/logger.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/logger.go deleted file mode 100644 index dc8f6e3..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/logger.go +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "fmt" - "io/ioutil" - "os" - "runtime" - "strings" - "time" - - "go.uber.org/zap/zapcore" -) - -// A Logger provides fast, leveled, structured logging. All methods are safe -// for concurrent use. -// -// The Logger is designed for contexts in which every microsecond and every -// allocation matters, so its API intentionally favors performance and type -// safety over brevity. For most applications, the SugaredLogger strikes a -// better balance between performance and ergonomics. -type Logger struct { - core zapcore.Core - - development bool - name string - errorOutput zapcore.WriteSyncer - - addCaller bool - addStack zapcore.LevelEnabler - - callerSkip int -} - -// New constructs a new Logger from the provided zapcore.Core and Options. If -// the passed zapcore.Core is nil, it falls back to using a no-op -// implementation. -// -// This is the most flexible way to construct a Logger, but also the most -// verbose. For typical use cases, the highly-opinionated presets -// (NewProduction, NewDevelopment, and NewExample) or the Config struct are -// more convenient. -// -// For sample code, see the package-level AdvancedConfiguration example. -func New(core zapcore.Core, options ...Option) *Logger { - if core == nil { - return NewNop() - } - log := &Logger{ - core: core, - errorOutput: zapcore.Lock(os.Stderr), - addStack: zapcore.FatalLevel + 1, - } - return log.WithOptions(options...) -} - -// NewNop returns a no-op Logger. It never writes out logs or internal errors, -// and it never runs user-defined hooks. -// -// Using WithOptions to replace the Core or error output of a no-op Logger can -// re-enable logging. -func NewNop() *Logger { - return &Logger{ - core: zapcore.NewNopCore(), - errorOutput: zapcore.AddSync(ioutil.Discard), - addStack: zapcore.FatalLevel + 1, - } -} - -// NewProduction builds a sensible production Logger that writes InfoLevel and -// above logs to standard error as JSON. -// -// It's a shortcut for NewProductionConfig().Build(...Option). -func NewProduction(options ...Option) (*Logger, error) { - return NewProductionConfig().Build(options...) -} - -// NewDevelopment builds a development Logger that writes DebugLevel and above -// logs to standard error in a human-friendly format. -// -// It's a shortcut for NewDevelopmentConfig().Build(...Option). -func NewDevelopment(options ...Option) (*Logger, error) { - return NewDevelopmentConfig().Build(options...) -} - -// NewExample builds a Logger that's designed for use in zap's testable -// examples. It writes DebugLevel and above logs to standard out as JSON, but -// omits the timestamp and calling function to keep example output -// short and deterministic. -func NewExample(options ...Option) *Logger { - encoderCfg := zapcore.EncoderConfig{ - MessageKey: "msg", - LevelKey: "level", - NameKey: "logger", - EncodeLevel: zapcore.LowercaseLevelEncoder, - EncodeTime: zapcore.ISO8601TimeEncoder, - EncodeDuration: zapcore.StringDurationEncoder, - } - core := zapcore.NewCore(zapcore.NewJSONEncoder(encoderCfg), os.Stdout, DebugLevel) - return New(core).WithOptions(options...) -} - -// Sugar wraps the Logger to provide a more ergonomic, but slightly slower, -// API. Sugaring a Logger is quite inexpensive, so it's reasonable for a -// single application to use both Loggers and SugaredLoggers, converting -// between them on the boundaries of performance-sensitive code. -func (log *Logger) Sugar() *SugaredLogger { - core := log.clone() - core.callerSkip += 2 - return &SugaredLogger{core} -} - -// Named adds a new path segment to the logger's name. Segments are joined by -// periods. By default, Loggers are unnamed. -func (log *Logger) Named(s string) *Logger { - if s == "" { - return log - } - l := log.clone() - if log.name == "" { - l.name = s - } else { - l.name = strings.Join([]string{l.name, s}, ".") - } - return l -} - -// WithOptions clones the current Logger, applies the supplied Options, and -// returns the resulting Logger. It's safe to use concurrently. -func (log *Logger) WithOptions(opts ...Option) *Logger { - c := log.clone() - for _, opt := range opts { - opt.apply(c) - } - return c -} - -// With creates a child logger and adds structured context to it. Fields added -// to the child don't affect the parent, and vice versa. -func (log *Logger) With(fields ...Field) *Logger { - if len(fields) == 0 { - return log - } - l := log.clone() - l.core = l.core.With(fields) - return l -} - -// Check returns a CheckedEntry if logging a message at the specified level -// is enabled. It's a completely optional optimization; in high-performance -// applications, Check can help avoid allocating a slice to hold fields. -func (log *Logger) Check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry { - return log.check(lvl, msg) -} - -// Debug logs a message at DebugLevel. The message includes any fields passed -// at the log site, as well as any fields accumulated on the logger. -func (log *Logger) Debug(msg string, fields ...Field) { - if ce := log.check(DebugLevel, msg); ce != nil { - ce.Write(fields...) - } -} - -// Info logs a message at InfoLevel. The message includes any fields passed -// at the log site, as well as any fields accumulated on the logger. -func (log *Logger) Info(msg string, fields ...Field) { - if ce := log.check(InfoLevel, msg); ce != nil { - ce.Write(fields...) - } -} - -// Warn logs a message at WarnLevel. The message includes any fields passed -// at the log site, as well as any fields accumulated on the logger. -func (log *Logger) Warn(msg string, fields ...Field) { - if ce := log.check(WarnLevel, msg); ce != nil { - ce.Write(fields...) - } -} - -// Error logs a message at ErrorLevel. The message includes any fields passed -// at the log site, as well as any fields accumulated on the logger. -func (log *Logger) Error(msg string, fields ...Field) { - if ce := log.check(ErrorLevel, msg); ce != nil { - ce.Write(fields...) - } -} - -// DPanic logs a message at DPanicLevel. The message includes any fields -// passed at the log site, as well as any fields accumulated on the logger. -// -// If the logger is in development mode, it then panics (DPanic means -// "development panic"). This is useful for catching errors that are -// recoverable, but shouldn't ever happen. -func (log *Logger) DPanic(msg string, fields ...Field) { - if ce := log.check(DPanicLevel, msg); ce != nil { - ce.Write(fields...) - } -} - -// Panic logs a message at PanicLevel. The message includes any fields passed -// at the log site, as well as any fields accumulated on the logger. -// -// The logger then panics, even if logging at PanicLevel is disabled. -func (log *Logger) Panic(msg string, fields ...Field) { - if ce := log.check(PanicLevel, msg); ce != nil { - ce.Write(fields...) - } -} - -// Fatal logs a message at FatalLevel. The message includes any fields passed -// at the log site, as well as any fields accumulated on the logger. -// -// The logger then calls os.Exit(1), even if logging at FatalLevel is -// disabled. -func (log *Logger) Fatal(msg string, fields ...Field) { - if ce := log.check(FatalLevel, msg); ce != nil { - ce.Write(fields...) - } -} - -// Sync calls the underlying Core's Sync method, flushing any buffered log -// entries. Applications should take care to call Sync before exiting. -func (log *Logger) Sync() error { - return log.core.Sync() -} - -// Core returns the Logger's underlying zapcore.Core. -func (log *Logger) Core() zapcore.Core { - return log.core -} - -func (log *Logger) clone() *Logger { - copy := *log - return © -} - -func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry { - // check must always be called directly by a method in the Logger interface - // (e.g., Check, Info, Fatal). - const callerSkipOffset = 2 - - // Create basic checked entry thru the core; this will be non-nil if the - // log message will actually be written somewhere. - ent := zapcore.Entry{ - LoggerName: log.name, - Time: time.Now(), - Level: lvl, - Message: msg, - } - ce := log.core.Check(ent, nil) - willWrite := ce != nil - - // Set up any required terminal behavior. - switch ent.Level { - case zapcore.PanicLevel: - ce = ce.Should(ent, zapcore.WriteThenPanic) - case zapcore.FatalLevel: - ce = ce.Should(ent, zapcore.WriteThenFatal) - case zapcore.DPanicLevel: - if log.development { - ce = ce.Should(ent, zapcore.WriteThenPanic) - } - } - - // Only do further annotation if we're going to write this message; checked - // entries that exist only for terminal behavior don't benefit from - // annotation. - if !willWrite { - return ce - } - - // Thread the error output through to the CheckedEntry. - ce.ErrorOutput = log.errorOutput - if log.addCaller { - ce.Entry.Caller = zapcore.NewEntryCaller(runtime.Caller(log.callerSkip + callerSkipOffset)) - if !ce.Entry.Caller.Defined { - fmt.Fprintf(log.errorOutput, "%v Logger.check error: failed to get caller\n", time.Now().UTC()) - log.errorOutput.Sync() - } - } - if log.addStack.Enabled(ce.Entry.Level) { - ce.Entry.Stack = Stack("").String - } - - return ce -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/options.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/options.go deleted file mode 100644 index 7a6b0fc..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/options.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import "go.uber.org/zap/zapcore" - -// An Option configures a Logger. -type Option interface { - apply(*Logger) -} - -// optionFunc wraps a func so it satisfies the Option interface. -type optionFunc func(*Logger) - -func (f optionFunc) apply(log *Logger) { - f(log) -} - -// WrapCore wraps or replaces the Logger's underlying zapcore.Core. -func WrapCore(f func(zapcore.Core) zapcore.Core) Option { - return optionFunc(func(log *Logger) { - log.core = f(log.core) - }) -} - -// Hooks registers functions which will be called each time the Logger writes -// out an Entry. Repeated use of Hooks is additive. -// -// Hooks are useful for simple side effects, like capturing metrics for the -// number of emitted logs. More complex side effects, including anything that -// requires access to the Entry's structured fields, should be implemented as -// a zapcore.Core instead. See zapcore.RegisterHooks for details. -func Hooks(hooks ...func(zapcore.Entry) error) Option { - return optionFunc(func(log *Logger) { - log.core = zapcore.RegisterHooks(log.core, hooks...) - }) -} - -// Fields adds fields to the Logger. -func Fields(fs ...Field) Option { - return optionFunc(func(log *Logger) { - log.core = log.core.With(fs) - }) -} - -// ErrorOutput sets the destination for errors generated by the Logger. Note -// that this option only affects internal errors; for sample code that sends -// error-level logs to a different location from info- and debug-level logs, -// see the package-level AdvancedConfiguration example. -// -// The supplied WriteSyncer must be safe for concurrent use. The Open and -// zapcore.Lock functions are the simplest ways to protect files with a mutex. -func ErrorOutput(w zapcore.WriteSyncer) Option { - return optionFunc(func(log *Logger) { - log.errorOutput = w - }) -} - -// Development puts the logger in development mode, which makes DPanic-level -// logs panic instead of simply logging an error. -func Development() Option { - return optionFunc(func(log *Logger) { - log.development = true - }) -} - -// AddCaller configures the Logger to annotate each message with the filename -// and line number of zap's caller. -func AddCaller() Option { - return optionFunc(func(log *Logger) { - log.addCaller = true - }) -} - -// AddCallerSkip increases the number of callers skipped by caller annotation -// (as enabled by the AddCaller option). When building wrappers around the -// Logger and SugaredLogger, supplying this Option prevents zap from always -// reporting the wrapper code as the caller. -func AddCallerSkip(skip int) Option { - return optionFunc(func(log *Logger) { - log.callerSkip += skip - }) -} - -// AddStacktrace configures the Logger to record a stack trace for all messages at -// or above a given level. -func AddStacktrace(lvl zapcore.LevelEnabler) Option { - return optionFunc(func(log *Logger) { - log.addStack = lvl - }) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/sink.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/sink.go deleted file mode 100644 index ff0becf..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/sink.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "errors" - "fmt" - "io" - "net/url" - "os" - "strings" - "sync" - - "go.uber.org/zap/zapcore" -) - -const schemeFile = "file" - -var ( - _sinkMutex sync.RWMutex - _sinkFactories map[string]func(*url.URL) (Sink, error) // keyed by scheme -) - -func init() { - resetSinkRegistry() -} - -func resetSinkRegistry() { - _sinkMutex.Lock() - defer _sinkMutex.Unlock() - - _sinkFactories = map[string]func(*url.URL) (Sink, error){ - schemeFile: newFileSink, - } -} - -// Sink defines the interface to write to and close logger destinations. -type Sink interface { - zapcore.WriteSyncer - io.Closer -} - -type nopCloserSink struct{ zapcore.WriteSyncer } - -func (nopCloserSink) Close() error { return nil } - -type errSinkNotFound struct { - scheme string -} - -func (e *errSinkNotFound) Error() string { - return fmt.Sprintf("no sink found for scheme %q", e.scheme) -} - -// RegisterSink registers a user-supplied factory for all sinks with a -// particular scheme. -// -// All schemes must be ASCII, valid under section 3.1 of RFC 3986 -// (https://tools.ietf.org/html/rfc3986#section-3.1), and must not already -// have a factory registered. Zap automatically registers a factory for the -// "file" scheme. -func RegisterSink(scheme string, factory func(*url.URL) (Sink, error)) error { - _sinkMutex.Lock() - defer _sinkMutex.Unlock() - - if scheme == "" { - return errors.New("can't register a sink factory for empty string") - } - normalized, err := normalizeScheme(scheme) - if err != nil { - return fmt.Errorf("%q is not a valid scheme: %v", scheme, err) - } - if _, ok := _sinkFactories[normalized]; ok { - return fmt.Errorf("sink factory already registered for scheme %q", normalized) - } - _sinkFactories[normalized] = factory - return nil -} - -func newSink(rawURL string) (Sink, error) { - u, err := url.Parse(rawURL) - if err != nil { - return nil, fmt.Errorf("can't parse %q as a URL: %v", rawURL, err) - } - if u.Scheme == "" { - u.Scheme = schemeFile - } - - _sinkMutex.RLock() - factory, ok := _sinkFactories[u.Scheme] - _sinkMutex.RUnlock() - if !ok { - return nil, &errSinkNotFound{u.Scheme} - } - return factory(u) -} - -func newFileSink(u *url.URL) (Sink, error) { - if u.User != nil { - return nil, fmt.Errorf("user and password not allowed with file URLs: got %v", u) - } - if u.Fragment != "" { - return nil, fmt.Errorf("fragments not allowed with file URLs: got %v", u) - } - if u.RawQuery != "" { - return nil, fmt.Errorf("query parameters not allowed with file URLs: got %v", u) - } - // Error messages are better if we check hostname and port separately. - if u.Port() != "" { - return nil, fmt.Errorf("ports not allowed with file URLs: got %v", u) - } - if hn := u.Hostname(); hn != "" && hn != "localhost" { - return nil, fmt.Errorf("file URLs must leave host empty or use localhost: got %v", u) - } - switch u.Path { - case "stdout": - return nopCloserSink{os.Stdout}, nil - case "stderr": - return nopCloserSink{os.Stderr}, nil - } - return os.OpenFile(u.Path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644) -} - -func normalizeScheme(s string) (string, error) { - // https://tools.ietf.org/html/rfc3986#section-3.1 - s = strings.ToLower(s) - if first := s[0]; 'a' > first || 'z' < first { - return "", errors.New("must start with a letter") - } - for i := 1; i < len(s); i++ { // iterate over bytes, not runes - c := s[i] - switch { - case 'a' <= c && c <= 'z': - continue - case '0' <= c && c <= '9': - continue - case c == '.' || c == '+' || c == '-': - continue - } - return "", fmt.Errorf("may not contain %q", c) - } - return s, nil -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/stacktrace.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/stacktrace.go deleted file mode 100644 index 100fac2..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/stacktrace.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "runtime" - "strings" - "sync" - - "go.uber.org/zap/internal/bufferpool" -) - -const _zapPackage = "go.uber.org/zap" - -var ( - _stacktracePool = sync.Pool{ - New: func() interface{} { - return newProgramCounters(64) - }, - } - - // We add "." and "/" suffixes to the package name to ensure we only match - // the exact package and not any package with the same prefix. - _zapStacktracePrefixes = addPrefix(_zapPackage, ".", "/") - _zapStacktraceVendorContains = addPrefix("/vendor/", _zapStacktracePrefixes...) -) - -func takeStacktrace() string { - buffer := bufferpool.Get() - defer buffer.Free() - programCounters := _stacktracePool.Get().(*programCounters) - defer _stacktracePool.Put(programCounters) - - var numFrames int - for { - // Skip the call to runtime.Counters and takeStacktrace so that the - // program counters start at the caller of takeStacktrace. - numFrames = runtime.Callers(2, programCounters.pcs) - if numFrames < len(programCounters.pcs) { - break - } - // Don't put the too-short counter slice back into the pool; this lets - // the pool adjust if we consistently take deep stacktraces. - programCounters = newProgramCounters(len(programCounters.pcs) * 2) - } - - i := 0 - skipZapFrames := true // skip all consecutive zap frames at the beginning. - frames := runtime.CallersFrames(programCounters.pcs[:numFrames]) - - // Note: On the last iteration, frames.Next() returns false, with a valid - // frame, but we ignore this frame. The last frame is a a runtime frame which - // adds noise, since it's only either runtime.main or runtime.goexit. - for frame, more := frames.Next(); more; frame, more = frames.Next() { - if skipZapFrames && isZapFrame(frame.Function) { - continue - } else { - skipZapFrames = false - } - - if i != 0 { - buffer.AppendByte('\n') - } - i++ - buffer.AppendString(frame.Function) - buffer.AppendByte('\n') - buffer.AppendByte('\t') - buffer.AppendString(frame.File) - buffer.AppendByte(':') - buffer.AppendInt(int64(frame.Line)) - } - - return buffer.String() -} - -func isZapFrame(function string) bool { - for _, prefix := range _zapStacktracePrefixes { - if strings.HasPrefix(function, prefix) { - return true - } - } - - // We can't use a prefix match here since the location of the vendor - // directory affects the prefix. Instead we do a contains match. - for _, contains := range _zapStacktraceVendorContains { - if strings.Contains(function, contains) { - return true - } - } - - return false -} - -type programCounters struct { - pcs []uintptr -} - -func newProgramCounters(size int) *programCounters { - return &programCounters{make([]uintptr, size)} -} - -func addPrefix(prefix string, ss ...string) []string { - withPrefix := make([]string, len(ss)) - for i, s := range ss { - withPrefix[i] = prefix + s - } - return withPrefix -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/sugar.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/sugar.go deleted file mode 100644 index 77ca227..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/sugar.go +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "fmt" - - "go.uber.org/zap/zapcore" - - "go.uber.org/multierr" -) - -const ( - _oddNumberErrMsg = "Ignored key without a value." - _nonStringKeyErrMsg = "Ignored key-value pairs with non-string keys." -) - -// A SugaredLogger wraps the base Logger functionality in a slower, but less -// verbose, API. Any Logger can be converted to a SugaredLogger with its Sugar -// method. -// -// Unlike the Logger, the SugaredLogger doesn't insist on structured logging. -// For each log level, it exposes three methods: one for loosely-typed -// structured logging, one for println-style formatting, and one for -// printf-style formatting. For example, SugaredLoggers can produce InfoLevel -// output with Infow ("info with" structured context), Info, or Infof. -type SugaredLogger struct { - base *Logger -} - -// Desugar unwraps a SugaredLogger, exposing the original Logger. Desugaring -// is quite inexpensive, so it's reasonable for a single application to use -// both Loggers and SugaredLoggers, converting between them on the boundaries -// of performance-sensitive code. -func (s *SugaredLogger) Desugar() *Logger { - base := s.base.clone() - base.callerSkip -= 2 - return base -} - -// Named adds a sub-scope to the logger's name. See Logger.Named for details. -func (s *SugaredLogger) Named(name string) *SugaredLogger { - return &SugaredLogger{base: s.base.Named(name)} -} - -// With adds a variadic number of fields to the logging context. It accepts a -// mix of strongly-typed Field objects and loosely-typed key-value pairs. When -// processing pairs, the first element of the pair is used as the field key -// and the second as the field value. -// -// For example, -// sugaredLogger.With( -// "hello", "world", -// "failure", errors.New("oh no"), -// Stack(), -// "count", 42, -// "user", User{Name: "alice"}, -// ) -// is the equivalent of -// unsugared.With( -// String("hello", "world"), -// String("failure", "oh no"), -// Stack(), -// Int("count", 42), -// Object("user", User{Name: "alice"}), -// ) -// -// Note that the keys in key-value pairs should be strings. In development, -// passing a non-string key panics. In production, the logger is more -// forgiving: a separate error is logged, but the key-value pair is skipped -// and execution continues. Passing an orphaned key triggers similar behavior: -// panics in development and errors in production. -func (s *SugaredLogger) With(args ...interface{}) *SugaredLogger { - return &SugaredLogger{base: s.base.With(s.sweetenFields(args)...)} -} - -// Debug uses fmt.Sprint to construct and log a message. -func (s *SugaredLogger) Debug(args ...interface{}) { - s.log(DebugLevel, "", args, nil) -} - -// Info uses fmt.Sprint to construct and log a message. -func (s *SugaredLogger) Info(args ...interface{}) { - s.log(InfoLevel, "", args, nil) -} - -// Warn uses fmt.Sprint to construct and log a message. -func (s *SugaredLogger) Warn(args ...interface{}) { - s.log(WarnLevel, "", args, nil) -} - -// Error uses fmt.Sprint to construct and log a message. -func (s *SugaredLogger) Error(args ...interface{}) { - s.log(ErrorLevel, "", args, nil) -} - -// DPanic uses fmt.Sprint to construct and log a message. In development, the -// logger then panics. (See DPanicLevel for details.) -func (s *SugaredLogger) DPanic(args ...interface{}) { - s.log(DPanicLevel, "", args, nil) -} - -// Panic uses fmt.Sprint to construct and log a message, then panics. -func (s *SugaredLogger) Panic(args ...interface{}) { - s.log(PanicLevel, "", args, nil) -} - -// Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit. -func (s *SugaredLogger) Fatal(args ...interface{}) { - s.log(FatalLevel, "", args, nil) -} - -// Debugf uses fmt.Sprintf to log a templated message. -func (s *SugaredLogger) Debugf(template string, args ...interface{}) { - s.log(DebugLevel, template, args, nil) -} - -// Infof uses fmt.Sprintf to log a templated message. -func (s *SugaredLogger) Infof(template string, args ...interface{}) { - s.log(InfoLevel, template, args, nil) -} - -// Warnf uses fmt.Sprintf to log a templated message. -func (s *SugaredLogger) Warnf(template string, args ...interface{}) { - s.log(WarnLevel, template, args, nil) -} - -// Errorf uses fmt.Sprintf to log a templated message. -func (s *SugaredLogger) Errorf(template string, args ...interface{}) { - s.log(ErrorLevel, template, args, nil) -} - -// DPanicf uses fmt.Sprintf to log a templated message. In development, the -// logger then panics. (See DPanicLevel for details.) -func (s *SugaredLogger) DPanicf(template string, args ...interface{}) { - s.log(DPanicLevel, template, args, nil) -} - -// Panicf uses fmt.Sprintf to log a templated message, then panics. -func (s *SugaredLogger) Panicf(template string, args ...interface{}) { - s.log(PanicLevel, template, args, nil) -} - -// Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit. -func (s *SugaredLogger) Fatalf(template string, args ...interface{}) { - s.log(FatalLevel, template, args, nil) -} - -// Debugw logs a message with some additional context. The variadic key-value -// pairs are treated as they are in With. -// -// When debug-level logging is disabled, this is much faster than -// s.With(keysAndValues).Debug(msg) -func (s *SugaredLogger) Debugw(msg string, keysAndValues ...interface{}) { - s.log(DebugLevel, msg, nil, keysAndValues) -} - -// Infow logs a message with some additional context. The variadic key-value -// pairs are treated as they are in With. -func (s *SugaredLogger) Infow(msg string, keysAndValues ...interface{}) { - s.log(InfoLevel, msg, nil, keysAndValues) -} - -// Warnw logs a message with some additional context. The variadic key-value -// pairs are treated as they are in With. -func (s *SugaredLogger) Warnw(msg string, keysAndValues ...interface{}) { - s.log(WarnLevel, msg, nil, keysAndValues) -} - -// Errorw logs a message with some additional context. The variadic key-value -// pairs are treated as they are in With. -func (s *SugaredLogger) Errorw(msg string, keysAndValues ...interface{}) { - s.log(ErrorLevel, msg, nil, keysAndValues) -} - -// DPanicw logs a message with some additional context. In development, the -// logger then panics. (See DPanicLevel for details.) The variadic key-value -// pairs are treated as they are in With. -func (s *SugaredLogger) DPanicw(msg string, keysAndValues ...interface{}) { - s.log(DPanicLevel, msg, nil, keysAndValues) -} - -// Panicw logs a message with some additional context, then panics. The -// variadic key-value pairs are treated as they are in With. -func (s *SugaredLogger) Panicw(msg string, keysAndValues ...interface{}) { - s.log(PanicLevel, msg, nil, keysAndValues) -} - -// Fatalw logs a message with some additional context, then calls os.Exit. The -// variadic key-value pairs are treated as they are in With. -func (s *SugaredLogger) Fatalw(msg string, keysAndValues ...interface{}) { - s.log(FatalLevel, msg, nil, keysAndValues) -} - -// Sync flushes any buffered log entries. -func (s *SugaredLogger) Sync() error { - return s.base.Sync() -} - -func (s *SugaredLogger) log(lvl zapcore.Level, template string, fmtArgs []interface{}, context []interface{}) { - // If logging at this level is completely disabled, skip the overhead of - // string formatting. - if lvl < DPanicLevel && !s.base.Core().Enabled(lvl) { - return - } - - // Format with Sprint, Sprintf, or neither. - msg := template - if msg == "" && len(fmtArgs) > 0 { - msg = fmt.Sprint(fmtArgs...) - } else if msg != "" && len(fmtArgs) > 0 { - msg = fmt.Sprintf(template, fmtArgs...) - } - - if ce := s.base.Check(lvl, msg); ce != nil { - ce.Write(s.sweetenFields(context)...) - } -} - -func (s *SugaredLogger) sweetenFields(args []interface{}) []Field { - if len(args) == 0 { - return nil - } - - // Allocate enough space for the worst case; if users pass only structured - // fields, we shouldn't penalize them with extra allocations. - fields := make([]Field, 0, len(args)) - var invalid invalidPairs - - for i := 0; i < len(args); { - // This is a strongly-typed field. Consume it and move on. - if f, ok := args[i].(Field); ok { - fields = append(fields, f) - i++ - continue - } - - // Make sure this element isn't a dangling key. - if i == len(args)-1 { - s.base.DPanic(_oddNumberErrMsg, Any("ignored", args[i])) - break - } - - // Consume this value and the next, treating them as a key-value pair. If the - // key isn't a string, add this pair to the slice of invalid pairs. - key, val := args[i], args[i+1] - if keyStr, ok := key.(string); !ok { - // Subsequent errors are likely, so allocate once up front. - if cap(invalid) == 0 { - invalid = make(invalidPairs, 0, len(args)/2) - } - invalid = append(invalid, invalidPair{i, key, val}) - } else { - fields = append(fields, Any(keyStr, val)) - } - i += 2 - } - - // If we encountered any invalid key-value pairs, log an error. - if len(invalid) > 0 { - s.base.DPanic(_nonStringKeyErrMsg, Array("invalid", invalid)) - } - return fields -} - -type invalidPair struct { - position int - key, value interface{} -} - -func (p invalidPair) MarshalLogObject(enc zapcore.ObjectEncoder) error { - enc.AddInt64("position", int64(p.position)) - Any("key", p.key).AddTo(enc) - Any("value", p.value).AddTo(enc) - return nil -} - -type invalidPairs []invalidPair - -func (ps invalidPairs) MarshalLogArray(enc zapcore.ArrayEncoder) error { - var err error - for i := range ps { - err = multierr.Append(err, enc.AppendObject(ps[i])) - } - return err -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/time.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/time.go deleted file mode 100644 index c5a1f16..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/time.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import "time" - -func timeToMillis(t time.Time) int64 { - return t.UnixNano() / int64(time.Millisecond) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/writer.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/writer.go deleted file mode 100644 index 86a709a..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/writer.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zap - -import ( - "fmt" - "io" - "io/ioutil" - - "go.uber.org/zap/zapcore" - - "go.uber.org/multierr" -) - -// Open is a high-level wrapper that takes a variadic number of URLs, opens or -// creates each of the specified resources, and combines them into a locked -// WriteSyncer. It also returns any error encountered and a function to close -// any opened files. -// -// Passing no URLs returns a no-op WriteSyncer. Zap handles URLs without a -// scheme and URLs with the "file" scheme. Third-party code may register -// factories for other schemes using RegisterSink. -// -// URLs with the "file" scheme must use absolute paths on the local -// filesystem. No user, password, port, fragments, or query parameters are -// allowed, and the hostname must be empty or "localhost". -// -// Since it's common to write logs to the local filesystem, URLs without a -// scheme (e.g., "/var/log/foo.log") are treated as local file paths. Without -// a scheme, the special paths "stdout" and "stderr" are interpreted as -// os.Stdout and os.Stderr. When specified without a scheme, relative file -// paths also work. -func Open(paths ...string) (zapcore.WriteSyncer, func(), error) { - writers, close, err := open(paths) - if err != nil { - return nil, nil, err - } - - writer := CombineWriteSyncers(writers...) - return writer, close, nil -} - -func open(paths []string) ([]zapcore.WriteSyncer, func(), error) { - writers := make([]zapcore.WriteSyncer, 0, len(paths)) - closers := make([]io.Closer, 0, len(paths)) - close := func() { - for _, c := range closers { - c.Close() - } - } - - var openErr error - for _, path := range paths { - sink, err := newSink(path) - if err != nil { - openErr = multierr.Append(openErr, fmt.Errorf("couldn't open sink %q: %v", path, err)) - continue - } - writers = append(writers, sink) - closers = append(closers, sink) - } - if openErr != nil { - close() - return writers, nil, openErr - } - - return writers, close, nil -} - -// CombineWriteSyncers is a utility that combines multiple WriteSyncers into a -// single, locked WriteSyncer. If no inputs are supplied, it returns a no-op -// WriteSyncer. -// -// It's provided purely as a convenience; the result is no different from -// using zapcore.NewMultiWriteSyncer and zapcore.Lock individually. -func CombineWriteSyncers(writers ...zapcore.WriteSyncer) zapcore.WriteSyncer { - if len(writers) == 0 { - return zapcore.AddSync(ioutil.Discard) - } - return zapcore.Lock(zapcore.NewMultiWriteSyncer(writers...)) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/console_encoder.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/console_encoder.go deleted file mode 100644 index b787596..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/console_encoder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "fmt" - "sync" - - "go.uber.org/zap/buffer" - "go.uber.org/zap/internal/bufferpool" -) - -var _sliceEncoderPool = sync.Pool{ - New: func() interface{} { - return &sliceArrayEncoder{elems: make([]interface{}, 0, 2)} - }, -} - -func getSliceEncoder() *sliceArrayEncoder { - return _sliceEncoderPool.Get().(*sliceArrayEncoder) -} - -func putSliceEncoder(e *sliceArrayEncoder) { - e.elems = e.elems[:0] - _sliceEncoderPool.Put(e) -} - -type consoleEncoder struct { - *jsonEncoder -} - -// NewConsoleEncoder creates an encoder whose output is designed for human - -// rather than machine - consumption. It serializes the core log entry data -// (message, level, timestamp, etc.) in a plain-text format and leaves the -// structured context as JSON. -// -// Note that although the console encoder doesn't use the keys specified in the -// encoder configuration, it will omit any element whose key is set to the empty -// string. -func NewConsoleEncoder(cfg EncoderConfig) Encoder { - return consoleEncoder{newJSONEncoder(cfg, true)} -} - -func (c consoleEncoder) Clone() Encoder { - return consoleEncoder{c.jsonEncoder.Clone().(*jsonEncoder)} -} - -func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, error) { - line := bufferpool.Get() - - // We don't want the entry's metadata to be quoted and escaped (if it's - // encoded as strings), which means that we can't use the JSON encoder. The - // simplest option is to use the memory encoder and fmt.Fprint. - // - // If this ever becomes a performance bottleneck, we can implement - // ArrayEncoder for our plain-text format. - arr := getSliceEncoder() - if c.TimeKey != "" && c.EncodeTime != nil { - c.EncodeTime(ent.Time, arr) - } - if c.LevelKey != "" && c.EncodeLevel != nil { - c.EncodeLevel(ent.Level, arr) - } - if ent.LoggerName != "" && c.NameKey != "" { - nameEncoder := c.EncodeName - - if nameEncoder == nil { - // Fall back to FullNameEncoder for backward compatibility. - nameEncoder = FullNameEncoder - } - - nameEncoder(ent.LoggerName, arr) - } - if ent.Caller.Defined && c.CallerKey != "" && c.EncodeCaller != nil { - c.EncodeCaller(ent.Caller, arr) - } - for i := range arr.elems { - if i > 0 { - line.AppendByte('\t') - } - fmt.Fprint(line, arr.elems[i]) - } - putSliceEncoder(arr) - - // Add the message itself. - if c.MessageKey != "" { - c.addTabIfNecessary(line) - line.AppendString(ent.Message) - } - - // Add any structured context. - c.writeContext(line, fields) - - // If there's no stacktrace key, honor that; this allows users to force - // single-line output. - if ent.Stack != "" && c.StacktraceKey != "" { - line.AppendByte('\n') - line.AppendString(ent.Stack) - } - - if c.LineEnding != "" { - line.AppendString(c.LineEnding) - } else { - line.AppendString(DefaultLineEnding) - } - return line, nil -} - -func (c consoleEncoder) writeContext(line *buffer.Buffer, extra []Field) { - context := c.jsonEncoder.Clone().(*jsonEncoder) - defer context.buf.Free() - - addFields(context, extra) - context.closeOpenNamespaces() - if context.buf.Len() == 0 { - return - } - - c.addTabIfNecessary(line) - line.AppendByte('{') - line.Write(context.buf.Bytes()) - line.AppendByte('}') -} - -func (c consoleEncoder) addTabIfNecessary(line *buffer.Buffer) { - if line.Len() > 0 { - line.AppendByte('\t') - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/core.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/core.go deleted file mode 100644 index a1ef8b0..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/core.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -// Core is a minimal, fast logger interface. It's designed for library authors -// to wrap in a more user-friendly API. -type Core interface { - LevelEnabler - - // With adds structured context to the Core. - With([]Field) Core - // Check determines whether the supplied Entry should be logged (using the - // embedded LevelEnabler and possibly some extra logic). If the entry - // should be logged, the Core adds itself to the CheckedEntry and returns - // the result. - // - // Callers must use Check before calling Write. - Check(Entry, *CheckedEntry) *CheckedEntry - // Write serializes the Entry and any Fields supplied at the log site and - // writes them to their destination. - // - // If called, Write should always log the Entry and Fields; it should not - // replicate the logic of Check. - Write(Entry, []Field) error - // Sync flushes buffered logs (if any). - Sync() error -} - -type nopCore struct{} - -// NewNopCore returns a no-op Core. -func NewNopCore() Core { return nopCore{} } -func (nopCore) Enabled(Level) bool { return false } -func (n nopCore) With([]Field) Core { return n } -func (nopCore) Check(_ Entry, ce *CheckedEntry) *CheckedEntry { return ce } -func (nopCore) Write(Entry, []Field) error { return nil } -func (nopCore) Sync() error { return nil } - -// NewCore creates a Core that writes logs to a WriteSyncer. -func NewCore(enc Encoder, ws WriteSyncer, enab LevelEnabler) Core { - return &ioCore{ - LevelEnabler: enab, - enc: enc, - out: ws, - } -} - -type ioCore struct { - LevelEnabler - enc Encoder - out WriteSyncer -} - -func (c *ioCore) With(fields []Field) Core { - clone := c.clone() - addFields(clone.enc, fields) - return clone -} - -func (c *ioCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { - if c.Enabled(ent.Level) { - return ce.AddCore(ent, c) - } - return ce -} - -func (c *ioCore) Write(ent Entry, fields []Field) error { - buf, err := c.enc.EncodeEntry(ent, fields) - if err != nil { - return err - } - _, err = c.out.Write(buf.Bytes()) - buf.Free() - if err != nil { - return err - } - if ent.Level > ErrorLevel { - // Since we may be crashing the program, sync the output. Ignore Sync - // errors, pending a clean solution to issue #370. - c.Sync() - } - return nil -} - -func (c *ioCore) Sync() error { - return c.out.Sync() -} - -func (c *ioCore) clone() *ioCore { - return &ioCore{ - LevelEnabler: c.LevelEnabler, - enc: c.enc.Clone(), - out: c.out, - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/doc.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/doc.go deleted file mode 100644 index 31000e9..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -// Package zapcore defines and implements the low-level interfaces upon which -// zap is built. By providing alternate implementations of these interfaces, -// external packages can extend zap's capabilities. -package zapcore // import "go.uber.org/zap/zapcore" diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/encoder.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/encoder.go deleted file mode 100644 index f050952..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/encoder.go +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "time" - - "go.uber.org/zap/buffer" -) - -// DefaultLineEnding defines the default line ending when writing logs. -// Alternate line endings specified in EncoderConfig can override this -// behavior. -const DefaultLineEnding = "\n" - -// A LevelEncoder serializes a Level to a primitive type. -type LevelEncoder func(Level, PrimitiveArrayEncoder) - -// LowercaseLevelEncoder serializes a Level to a lowercase string. For example, -// InfoLevel is serialized to "info". -func LowercaseLevelEncoder(l Level, enc PrimitiveArrayEncoder) { - enc.AppendString(l.String()) -} - -// LowercaseColorLevelEncoder serializes a Level to a lowercase string and adds coloring. -// For example, InfoLevel is serialized to "info" and colored blue. -func LowercaseColorLevelEncoder(l Level, enc PrimitiveArrayEncoder) { - s, ok := _levelToLowercaseColorString[l] - if !ok { - s = _unknownLevelColor.Add(l.String()) - } - enc.AppendString(s) -} - -// CapitalLevelEncoder serializes a Level to an all-caps string. For example, -// InfoLevel is serialized to "INFO". -func CapitalLevelEncoder(l Level, enc PrimitiveArrayEncoder) { - enc.AppendString(l.CapitalString()) -} - -// CapitalColorLevelEncoder serializes a Level to an all-caps string and adds color. -// For example, InfoLevel is serialized to "INFO" and colored blue. -func CapitalColorLevelEncoder(l Level, enc PrimitiveArrayEncoder) { - s, ok := _levelToCapitalColorString[l] - if !ok { - s = _unknownLevelColor.Add(l.CapitalString()) - } - enc.AppendString(s) -} - -// UnmarshalText unmarshals text to a LevelEncoder. "capital" is unmarshaled to -// CapitalLevelEncoder, "coloredCapital" is unmarshaled to CapitalColorLevelEncoder, -// "colored" is unmarshaled to LowercaseColorLevelEncoder, and anything else -// is unmarshaled to LowercaseLevelEncoder. -func (e *LevelEncoder) UnmarshalText(text []byte) error { - switch string(text) { - case "capital": - *e = CapitalLevelEncoder - case "capitalColor": - *e = CapitalColorLevelEncoder - case "color": - *e = LowercaseColorLevelEncoder - default: - *e = LowercaseLevelEncoder - } - return nil -} - -// A TimeEncoder serializes a time.Time to a primitive type. -type TimeEncoder func(time.Time, PrimitiveArrayEncoder) - -// EpochTimeEncoder serializes a time.Time to a floating-point number of seconds -// since the Unix epoch. -func EpochTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { - nanos := t.UnixNano() - sec := float64(nanos) / float64(time.Second) - enc.AppendFloat64(sec) -} - -// EpochMillisTimeEncoder serializes a time.Time to a floating-point number of -// milliseconds since the Unix epoch. -func EpochMillisTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { - nanos := t.UnixNano() - millis := float64(nanos) / float64(time.Millisecond) - enc.AppendFloat64(millis) -} - -// EpochNanosTimeEncoder serializes a time.Time to an integer number of -// nanoseconds since the Unix epoch. -func EpochNanosTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { - enc.AppendInt64(t.UnixNano()) -} - -// ISO8601TimeEncoder serializes a time.Time to an ISO8601-formatted string -// with millisecond precision. -func ISO8601TimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { - enc.AppendString(t.Format("2006-01-02T15:04:05.000Z0700")) -} - -// UnmarshalText unmarshals text to a TimeEncoder. "iso8601" and "ISO8601" are -// unmarshaled to ISO8601TimeEncoder, "millis" is unmarshaled to -// EpochMillisTimeEncoder, and anything else is unmarshaled to EpochTimeEncoder. -func (e *TimeEncoder) UnmarshalText(text []byte) error { - switch string(text) { - case "iso8601", "ISO8601": - *e = ISO8601TimeEncoder - case "millis": - *e = EpochMillisTimeEncoder - case "nanos": - *e = EpochNanosTimeEncoder - default: - *e = EpochTimeEncoder - } - return nil -} - -// A DurationEncoder serializes a time.Duration to a primitive type. -type DurationEncoder func(time.Duration, PrimitiveArrayEncoder) - -// SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds elapsed. -func SecondsDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) { - enc.AppendFloat64(float64(d) / float64(time.Second)) -} - -// NanosDurationEncoder serializes a time.Duration to an integer number of -// nanoseconds elapsed. -func NanosDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) { - enc.AppendInt64(int64(d)) -} - -// StringDurationEncoder serializes a time.Duration using its built-in String -// method. -func StringDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) { - enc.AppendString(d.String()) -} - -// UnmarshalText unmarshals text to a DurationEncoder. "string" is unmarshaled -// to StringDurationEncoder, and anything else is unmarshaled to -// NanosDurationEncoder. -func (e *DurationEncoder) UnmarshalText(text []byte) error { - switch string(text) { - case "string": - *e = StringDurationEncoder - case "nanos": - *e = NanosDurationEncoder - default: - *e = SecondsDurationEncoder - } - return nil -} - -// A CallerEncoder serializes an EntryCaller to a primitive type. -type CallerEncoder func(EntryCaller, PrimitiveArrayEncoder) - -// FullCallerEncoder serializes a caller in /full/path/to/package/file:line -// format. -func FullCallerEncoder(caller EntryCaller, enc PrimitiveArrayEncoder) { - // TODO: consider using a byte-oriented API to save an allocation. - enc.AppendString(caller.String()) -} - -// ShortCallerEncoder serializes a caller in package/file:line format, trimming -// all but the final directory from the full path. -func ShortCallerEncoder(caller EntryCaller, enc PrimitiveArrayEncoder) { - // TODO: consider using a byte-oriented API to save an allocation. - enc.AppendString(caller.TrimmedPath()) -} - -// UnmarshalText unmarshals text to a CallerEncoder. "full" is unmarshaled to -// FullCallerEncoder and anything else is unmarshaled to ShortCallerEncoder. -func (e *CallerEncoder) UnmarshalText(text []byte) error { - switch string(text) { - case "full": - *e = FullCallerEncoder - default: - *e = ShortCallerEncoder - } - return nil -} - -// A NameEncoder serializes a period-separated logger name to a primitive -// type. -type NameEncoder func(string, PrimitiveArrayEncoder) - -// FullNameEncoder serializes the logger name as-is. -func FullNameEncoder(loggerName string, enc PrimitiveArrayEncoder) { - enc.AppendString(loggerName) -} - -// UnmarshalText unmarshals text to a NameEncoder. Currently, everything is -// unmarshaled to FullNameEncoder. -func (e *NameEncoder) UnmarshalText(text []byte) error { - switch string(text) { - case "full": - *e = FullNameEncoder - default: - *e = FullNameEncoder - } - return nil -} - -// An EncoderConfig allows users to configure the concrete encoders supplied by -// zapcore. -type EncoderConfig struct { - // Set the keys used for each log entry. If any key is empty, that portion - // of the entry is omitted. - MessageKey string `json:"messageKey" yaml:"messageKey"` - LevelKey string `json:"levelKey" yaml:"levelKey"` - TimeKey string `json:"timeKey" yaml:"timeKey"` - NameKey string `json:"nameKey" yaml:"nameKey"` - CallerKey string `json:"callerKey" yaml:"callerKey"` - StacktraceKey string `json:"stacktraceKey" yaml:"stacktraceKey"` - LineEnding string `json:"lineEnding" yaml:"lineEnding"` - // Configure the primitive representations of common complex types. For - // example, some users may want all time.Times serialized as floating-point - // seconds since epoch, while others may prefer ISO8601 strings. - EncodeLevel LevelEncoder `json:"levelEncoder" yaml:"levelEncoder"` - EncodeTime TimeEncoder `json:"timeEncoder" yaml:"timeEncoder"` - EncodeDuration DurationEncoder `json:"durationEncoder" yaml:"durationEncoder"` - EncodeCaller CallerEncoder `json:"callerEncoder" yaml:"callerEncoder"` - // Unlike the other primitive type encoders, EncodeName is optional. The - // zero value falls back to FullNameEncoder. - EncodeName NameEncoder `json:"nameEncoder" yaml:"nameEncoder"` -} - -// ObjectEncoder is a strongly-typed, encoding-agnostic interface for adding a -// map- or struct-like object to the logging context. Like maps, ObjectEncoders -// aren't safe for concurrent use (though typical use shouldn't require locks). -type ObjectEncoder interface { - // Logging-specific marshalers. - AddArray(key string, marshaler ArrayMarshaler) error - AddObject(key string, marshaler ObjectMarshaler) error - - // Built-in types. - AddBinary(key string, value []byte) // for arbitrary bytes - AddByteString(key string, value []byte) // for UTF-8 encoded bytes - AddBool(key string, value bool) - AddComplex128(key string, value complex128) - AddComplex64(key string, value complex64) - AddDuration(key string, value time.Duration) - AddFloat64(key string, value float64) - AddFloat32(key string, value float32) - AddInt(key string, value int) - AddInt64(key string, value int64) - AddInt32(key string, value int32) - AddInt16(key string, value int16) - AddInt8(key string, value int8) - AddString(key, value string) - AddTime(key string, value time.Time) - AddUint(key string, value uint) - AddUint64(key string, value uint64) - AddUint32(key string, value uint32) - AddUint16(key string, value uint16) - AddUint8(key string, value uint8) - AddUintptr(key string, value uintptr) - - // AddReflected uses reflection to serialize arbitrary objects, so it's slow - // and allocation-heavy. - AddReflected(key string, value interface{}) error - // OpenNamespace opens an isolated namespace where all subsequent fields will - // be added. Applications can use namespaces to prevent key collisions when - // injecting loggers into sub-components or third-party libraries. - OpenNamespace(key string) -} - -// ArrayEncoder is a strongly-typed, encoding-agnostic interface for adding -// array-like objects to the logging context. Of note, it supports mixed-type -// arrays even though they aren't typical in Go. Like slices, ArrayEncoders -// aren't safe for concurrent use (though typical use shouldn't require locks). -type ArrayEncoder interface { - // Built-in types. - PrimitiveArrayEncoder - - // Time-related types. - AppendDuration(time.Duration) - AppendTime(time.Time) - - // Logging-specific marshalers. - AppendArray(ArrayMarshaler) error - AppendObject(ObjectMarshaler) error - - // AppendReflected uses reflection to serialize arbitrary objects, so it's - // slow and allocation-heavy. - AppendReflected(value interface{}) error -} - -// PrimitiveArrayEncoder is the subset of the ArrayEncoder interface that deals -// only in Go's built-in types. It's included only so that Duration- and -// TimeEncoders cannot trigger infinite recursion. -type PrimitiveArrayEncoder interface { - // Built-in types. - AppendBool(bool) - AppendByteString([]byte) // for UTF-8 encoded bytes - AppendComplex128(complex128) - AppendComplex64(complex64) - AppendFloat64(float64) - AppendFloat32(float32) - AppendInt(int) - AppendInt64(int64) - AppendInt32(int32) - AppendInt16(int16) - AppendInt8(int8) - AppendString(string) - AppendUint(uint) - AppendUint64(uint64) - AppendUint32(uint32) - AppendUint16(uint16) - AppendUint8(uint8) - AppendUintptr(uintptr) -} - -// Encoder is a format-agnostic interface for all log entry marshalers. Since -// log encoders don't need to support the same wide range of use cases as -// general-purpose marshalers, it's possible to make them faster and -// lower-allocation. -// -// Implementations of the ObjectEncoder interface's methods can, of course, -// freely modify the receiver. However, the Clone and EncodeEntry methods will -// be called concurrently and shouldn't modify the receiver. -type Encoder interface { - ObjectEncoder - - // Clone copies the encoder, ensuring that adding fields to the copy doesn't - // affect the original. - Clone() Encoder - - // EncodeEntry encodes an entry and fields, along with any accumulated - // context, into a byte buffer and returns it. - EncodeEntry(Entry, []Field) (*buffer.Buffer, error) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/entry.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/entry.go deleted file mode 100644 index 7d9893f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/entry.go +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "fmt" - "strings" - "sync" - "time" - - "go.uber.org/zap/internal/bufferpool" - "go.uber.org/zap/internal/exit" - - "go.uber.org/multierr" -) - -var ( - _cePool = sync.Pool{New: func() interface{} { - // Pre-allocate some space for cores. - return &CheckedEntry{ - cores: make([]Core, 4), - } - }} -) - -func getCheckedEntry() *CheckedEntry { - ce := _cePool.Get().(*CheckedEntry) - ce.reset() - return ce -} - -func putCheckedEntry(ce *CheckedEntry) { - if ce == nil { - return - } - _cePool.Put(ce) -} - -// NewEntryCaller makes an EntryCaller from the return signature of -// runtime.Caller. -func NewEntryCaller(pc uintptr, file string, line int, ok bool) EntryCaller { - if !ok { - return EntryCaller{} - } - return EntryCaller{ - PC: pc, - File: file, - Line: line, - Defined: true, - } -} - -// EntryCaller represents the caller of a logging function. -type EntryCaller struct { - Defined bool - PC uintptr - File string - Line int -} - -// String returns the full path and line number of the caller. -func (ec EntryCaller) String() string { - return ec.FullPath() -} - -// FullPath returns a /full/path/to/package/file:line description of the -// caller. -func (ec EntryCaller) FullPath() string { - if !ec.Defined { - return "undefined" - } - buf := bufferpool.Get() - buf.AppendString(ec.File) - buf.AppendByte(':') - buf.AppendInt(int64(ec.Line)) - caller := buf.String() - buf.Free() - return caller -} - -// TrimmedPath returns a package/file:line description of the caller, -// preserving only the leaf directory name and file name. -func (ec EntryCaller) TrimmedPath() string { - if !ec.Defined { - return "undefined" - } - // nb. To make sure we trim the path correctly on Windows too, we - // counter-intuitively need to use '/' and *not* os.PathSeparator here, - // because the path given originates from Go stdlib, specifically - // runtime.Caller() which (as of Mar/17) returns forward slashes even on - // Windows. - // - // See https://github.com/golang/go/issues/3335 - // and https://github.com/golang/go/issues/18151 - // - // for discussion on the issue on Go side. - // - // Find the last separator. - // - idx := strings.LastIndexByte(ec.File, '/') - if idx == -1 { - return ec.FullPath() - } - // Find the penultimate separator. - idx = strings.LastIndexByte(ec.File[:idx], '/') - if idx == -1 { - return ec.FullPath() - } - buf := bufferpool.Get() - // Keep everything after the penultimate separator. - buf.AppendString(ec.File[idx+1:]) - buf.AppendByte(':') - buf.AppendInt(int64(ec.Line)) - caller := buf.String() - buf.Free() - return caller -} - -// An Entry represents a complete log message. The entry's structured context -// is already serialized, but the log level, time, message, and call site -// information are available for inspection and modification. -// -// Entries are pooled, so any functions that accept them MUST be careful not to -// retain references to them. -type Entry struct { - Level Level - Time time.Time - LoggerName string - Message string - Caller EntryCaller - Stack string -} - -// CheckWriteAction indicates what action to take after a log entry is -// processed. Actions are ordered in increasing severity. -type CheckWriteAction uint8 - -const ( - // WriteThenNoop indicates that nothing special needs to be done. It's the - // default behavior. - WriteThenNoop CheckWriteAction = iota - // WriteThenPanic causes a panic after Write. - WriteThenPanic - // WriteThenFatal causes a fatal os.Exit after Write. - WriteThenFatal -) - -// CheckedEntry is an Entry together with a collection of Cores that have -// already agreed to log it. -// -// CheckedEntry references should be created by calling AddCore or Should on a -// nil *CheckedEntry. References are returned to a pool after Write, and MUST -// NOT be retained after calling their Write method. -type CheckedEntry struct { - Entry - ErrorOutput WriteSyncer - dirty bool // best-effort detection of pool misuse - should CheckWriteAction - cores []Core -} - -func (ce *CheckedEntry) reset() { - ce.Entry = Entry{} - ce.ErrorOutput = nil - ce.dirty = false - ce.should = WriteThenNoop - for i := range ce.cores { - // don't keep references to cores - ce.cores[i] = nil - } - ce.cores = ce.cores[:0] -} - -// Write writes the entry to the stored Cores, returns any errors, and returns -// the CheckedEntry reference to a pool for immediate re-use. Finally, it -// executes any required CheckWriteAction. -func (ce *CheckedEntry) Write(fields ...Field) { - if ce == nil { - return - } - - if ce.dirty { - if ce.ErrorOutput != nil { - // Make a best effort to detect unsafe re-use of this CheckedEntry. - // If the entry is dirty, log an internal error; because the - // CheckedEntry is being used after it was returned to the pool, - // the message may be an amalgamation from multiple call sites. - fmt.Fprintf(ce.ErrorOutput, "%v Unsafe CheckedEntry re-use near Entry %+v.\n", time.Now(), ce.Entry) - ce.ErrorOutput.Sync() - } - return - } - ce.dirty = true - - var err error - for i := range ce.cores { - err = multierr.Append(err, ce.cores[i].Write(ce.Entry, fields)) - } - if ce.ErrorOutput != nil { - if err != nil { - fmt.Fprintf(ce.ErrorOutput, "%v write error: %v\n", time.Now(), err) - ce.ErrorOutput.Sync() - } - } - - should, msg := ce.should, ce.Message - putCheckedEntry(ce) - - switch should { - case WriteThenPanic: - panic(msg) - case WriteThenFatal: - exit.Exit() - } -} - -// AddCore adds a Core that has agreed to log this CheckedEntry. It's intended to be -// used by Core.Check implementations, and is safe to call on nil CheckedEntry -// references. -func (ce *CheckedEntry) AddCore(ent Entry, core Core) *CheckedEntry { - if ce == nil { - ce = getCheckedEntry() - ce.Entry = ent - } - ce.cores = append(ce.cores, core) - return ce -} - -// Should sets this CheckedEntry's CheckWriteAction, which controls whether a -// Core will panic or fatal after writing this log entry. Like AddCore, it's -// safe to call on nil CheckedEntry references. -func (ce *CheckedEntry) Should(ent Entry, should CheckWriteAction) *CheckedEntry { - if ce == nil { - ce = getCheckedEntry() - ce.Entry = ent - } - ce.should = should - return ce -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/error.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/error.go deleted file mode 100644 index a67c7ba..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/error.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2017 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "fmt" - "sync" -) - -// Encodes the given error into fields of an object. A field with the given -// name is added for the error message. -// -// If the error implements fmt.Formatter, a field with the name ${key}Verbose -// is also added with the full verbose error message. -// -// Finally, if the error implements errorGroup (from go.uber.org/multierr) or -// causer (from github.com/pkg/errors), a ${key}Causes field is added with an -// array of objects containing the errors this error was comprised of. -// -// { -// "error": err.Error(), -// "errorVerbose": fmt.Sprintf("%+v", err), -// "errorCauses": [ -// ... -// ], -// } -func encodeError(key string, err error, enc ObjectEncoder) error { - basic := err.Error() - enc.AddString(key, basic) - - switch e := err.(type) { - case errorGroup: - return enc.AddArray(key+"Causes", errArray(e.Errors())) - case fmt.Formatter: - verbose := fmt.Sprintf("%+v", e) - if verbose != basic { - // This is a rich error type, like those produced by - // github.com/pkg/errors. - enc.AddString(key+"Verbose", verbose) - } - } - return nil -} - -type errorGroup interface { - // Provides read-only access to the underlying list of errors, preferably - // without causing any allocs. - Errors() []error -} - -type causer interface { - // Provides access to the error that caused this error. - Cause() error -} - -// Note that errArry and errArrayElem are very similar to the version -// implemented in the top-level error.go file. We can't re-use this because -// that would require exporting errArray as part of the zapcore API. - -// Encodes a list of errors using the standard error encoding logic. -type errArray []error - -func (errs errArray) MarshalLogArray(arr ArrayEncoder) error { - for i := range errs { - if errs[i] == nil { - continue - } - - el := newErrArrayElem(errs[i]) - arr.AppendObject(el) - el.Free() - } - return nil -} - -var _errArrayElemPool = sync.Pool{New: func() interface{} { - return &errArrayElem{} -}} - -// Encodes any error into a {"error": ...} re-using the same errors logic. -// -// May be passed in place of an array to build a single-element array. -type errArrayElem struct{ err error } - -func newErrArrayElem(err error) *errArrayElem { - e := _errArrayElemPool.Get().(*errArrayElem) - e.err = err - return e -} - -func (e *errArrayElem) MarshalLogArray(arr ArrayEncoder) error { - return arr.AppendObject(e) -} - -func (e *errArrayElem) MarshalLogObject(enc ObjectEncoder) error { - return encodeError("error", e.err, enc) -} - -func (e *errArrayElem) Free() { - e.err = nil - _errArrayElemPool.Put(e) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/field.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/field.go deleted file mode 100644 index 6a5e33e..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/field.go +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "bytes" - "fmt" - "math" - "reflect" - "time" -) - -// A FieldType indicates which member of the Field union struct should be used -// and how it should be serialized. -type FieldType uint8 - -const ( - // UnknownType is the default field type. Attempting to add it to an encoder will panic. - UnknownType FieldType = iota - // ArrayMarshalerType indicates that the field carries an ArrayMarshaler. - ArrayMarshalerType - // ObjectMarshalerType indicates that the field carries an ObjectMarshaler. - ObjectMarshalerType - // BinaryType indicates that the field carries an opaque binary blob. - BinaryType - // BoolType indicates that the field carries a bool. - BoolType - // ByteStringType indicates that the field carries UTF-8 encoded bytes. - ByteStringType - // Complex128Type indicates that the field carries a complex128. - Complex128Type - // Complex64Type indicates that the field carries a complex128. - Complex64Type - // DurationType indicates that the field carries a time.Duration. - DurationType - // Float64Type indicates that the field carries a float64. - Float64Type - // Float32Type indicates that the field carries a float32. - Float32Type - // Int64Type indicates that the field carries an int64. - Int64Type - // Int32Type indicates that the field carries an int32. - Int32Type - // Int16Type indicates that the field carries an int16. - Int16Type - // Int8Type indicates that the field carries an int8. - Int8Type - // StringType indicates that the field carries a string. - StringType - // TimeType indicates that the field carries a time.Time. - TimeType - // Uint64Type indicates that the field carries a uint64. - Uint64Type - // Uint32Type indicates that the field carries a uint32. - Uint32Type - // Uint16Type indicates that the field carries a uint16. - Uint16Type - // Uint8Type indicates that the field carries a uint8. - Uint8Type - // UintptrType indicates that the field carries a uintptr. - UintptrType - // ReflectType indicates that the field carries an interface{}, which should - // be serialized using reflection. - ReflectType - // NamespaceType signals the beginning of an isolated namespace. All - // subsequent fields should be added to the new namespace. - NamespaceType - // StringerType indicates that the field carries a fmt.Stringer. - StringerType - // ErrorType indicates that the field carries an error. - ErrorType - // SkipType indicates that the field is a no-op. - SkipType -) - -// A Field is a marshaling operation used to add a key-value pair to a logger's -// context. Most fields are lazily marshaled, so it's inexpensive to add fields -// to disabled debug-level log statements. -type Field struct { - Key string - Type FieldType - Integer int64 - String string - Interface interface{} -} - -// AddTo exports a field through the ObjectEncoder interface. It's primarily -// useful to library authors, and shouldn't be necessary in most applications. -func (f Field) AddTo(enc ObjectEncoder) { - var err error - - switch f.Type { - case ArrayMarshalerType: - err = enc.AddArray(f.Key, f.Interface.(ArrayMarshaler)) - case ObjectMarshalerType: - err = enc.AddObject(f.Key, f.Interface.(ObjectMarshaler)) - case BinaryType: - enc.AddBinary(f.Key, f.Interface.([]byte)) - case BoolType: - enc.AddBool(f.Key, f.Integer == 1) - case ByteStringType: - enc.AddByteString(f.Key, f.Interface.([]byte)) - case Complex128Type: - enc.AddComplex128(f.Key, f.Interface.(complex128)) - case Complex64Type: - enc.AddComplex64(f.Key, f.Interface.(complex64)) - case DurationType: - enc.AddDuration(f.Key, time.Duration(f.Integer)) - case Float64Type: - enc.AddFloat64(f.Key, math.Float64frombits(uint64(f.Integer))) - case Float32Type: - enc.AddFloat32(f.Key, math.Float32frombits(uint32(f.Integer))) - case Int64Type: - enc.AddInt64(f.Key, f.Integer) - case Int32Type: - enc.AddInt32(f.Key, int32(f.Integer)) - case Int16Type: - enc.AddInt16(f.Key, int16(f.Integer)) - case Int8Type: - enc.AddInt8(f.Key, int8(f.Integer)) - case StringType: - enc.AddString(f.Key, f.String) - case TimeType: - if f.Interface != nil { - enc.AddTime(f.Key, time.Unix(0, f.Integer).In(f.Interface.(*time.Location))) - } else { - // Fall back to UTC if location is nil. - enc.AddTime(f.Key, time.Unix(0, f.Integer)) - } - case Uint64Type: - enc.AddUint64(f.Key, uint64(f.Integer)) - case Uint32Type: - enc.AddUint32(f.Key, uint32(f.Integer)) - case Uint16Type: - enc.AddUint16(f.Key, uint16(f.Integer)) - case Uint8Type: - enc.AddUint8(f.Key, uint8(f.Integer)) - case UintptrType: - enc.AddUintptr(f.Key, uintptr(f.Integer)) - case ReflectType: - err = enc.AddReflected(f.Key, f.Interface) - case NamespaceType: - enc.OpenNamespace(f.Key) - case StringerType: - enc.AddString(f.Key, f.Interface.(fmt.Stringer).String()) - case ErrorType: - encodeError(f.Key, f.Interface.(error), enc) - case SkipType: - break - default: - panic(fmt.Sprintf("unknown field type: %v", f)) - } - - if err != nil { - enc.AddString(fmt.Sprintf("%sError", f.Key), err.Error()) - } -} - -// Equals returns whether two fields are equal. For non-primitive types such as -// errors, marshalers, or reflect types, it uses reflect.DeepEqual. -func (f Field) Equals(other Field) bool { - if f.Type != other.Type { - return false - } - if f.Key != other.Key { - return false - } - - switch f.Type { - case BinaryType, ByteStringType: - return bytes.Equal(f.Interface.([]byte), other.Interface.([]byte)) - case ArrayMarshalerType, ObjectMarshalerType, ErrorType, ReflectType: - return reflect.DeepEqual(f.Interface, other.Interface) - default: - return f == other - } -} - -func addFields(enc ObjectEncoder, fields []Field) { - for i := range fields { - fields[i].AddTo(enc) - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/hook.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/hook.go deleted file mode 100644 index 5db4afb..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/hook.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import "go.uber.org/multierr" - -type hooked struct { - Core - funcs []func(Entry) error -} - -// RegisterHooks wraps a Core and runs a collection of user-defined callback -// hooks each time a message is logged. Execution of the callbacks is blocking. -// -// This offers users an easy way to register simple callbacks (e.g., metrics -// collection) without implementing the full Core interface. -func RegisterHooks(core Core, hooks ...func(Entry) error) Core { - funcs := append([]func(Entry) error{}, hooks...) - return &hooked{ - Core: core, - funcs: funcs, - } -} - -func (h *hooked) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { - // Let the wrapped Core decide whether to log this message or not. This - // also gives the downstream a chance to register itself directly with the - // CheckedEntry. - if downstream := h.Core.Check(ent, ce); downstream != nil { - return downstream.AddCore(ent, h) - } - return ce -} - -func (h *hooked) With(fields []Field) Core { - return &hooked{ - Core: h.Core.With(fields), - funcs: h.funcs, - } -} - -func (h *hooked) Write(ent Entry, _ []Field) error { - // Since our downstream had a chance to register itself directly with the - // CheckedMessage, we don't need to call it here. - var err error - for i := range h.funcs { - err = multierr.Append(err, h.funcs[i](ent)) - } - return err -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/json_encoder.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/json_encoder.go deleted file mode 100644 index 2dc67d8..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/json_encoder.go +++ /dev/null @@ -1,502 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "encoding/base64" - "encoding/json" - "math" - "sync" - "time" - "unicode/utf8" - - "go.uber.org/zap/buffer" - "go.uber.org/zap/internal/bufferpool" -) - -// For JSON-escaping; see jsonEncoder.safeAddString below. -const _hex = "0123456789abcdef" - -var _jsonPool = sync.Pool{New: func() interface{} { - return &jsonEncoder{} -}} - -func getJSONEncoder() *jsonEncoder { - return _jsonPool.Get().(*jsonEncoder) -} - -func putJSONEncoder(enc *jsonEncoder) { - if enc.reflectBuf != nil { - enc.reflectBuf.Free() - } - enc.EncoderConfig = nil - enc.buf = nil - enc.spaced = false - enc.openNamespaces = 0 - enc.reflectBuf = nil - enc.reflectEnc = nil - _jsonPool.Put(enc) -} - -type jsonEncoder struct { - *EncoderConfig - buf *buffer.Buffer - spaced bool // include spaces after colons and commas - openNamespaces int - - // for encoding generic values by reflection - reflectBuf *buffer.Buffer - reflectEnc *json.Encoder -} - -// NewJSONEncoder creates a fast, low-allocation JSON encoder. The encoder -// appropriately escapes all field keys and values. -// -// Note that the encoder doesn't deduplicate keys, so it's possible to produce -// a message like -// {"foo":"bar","foo":"baz"} -// This is permitted by the JSON specification, but not encouraged. Many -// libraries will ignore duplicate key-value pairs (typically keeping the last -// pair) when unmarshaling, but users should attempt to avoid adding duplicate -// keys. -func NewJSONEncoder(cfg EncoderConfig) Encoder { - return newJSONEncoder(cfg, false) -} - -func newJSONEncoder(cfg EncoderConfig, spaced bool) *jsonEncoder { - return &jsonEncoder{ - EncoderConfig: &cfg, - buf: bufferpool.Get(), - spaced: spaced, - } -} - -func (enc *jsonEncoder) AddArray(key string, arr ArrayMarshaler) error { - enc.addKey(key) - return enc.AppendArray(arr) -} - -func (enc *jsonEncoder) AddObject(key string, obj ObjectMarshaler) error { - enc.addKey(key) - return enc.AppendObject(obj) -} - -func (enc *jsonEncoder) AddBinary(key string, val []byte) { - enc.AddString(key, base64.StdEncoding.EncodeToString(val)) -} - -func (enc *jsonEncoder) AddByteString(key string, val []byte) { - enc.addKey(key) - enc.AppendByteString(val) -} - -func (enc *jsonEncoder) AddBool(key string, val bool) { - enc.addKey(key) - enc.AppendBool(val) -} - -func (enc *jsonEncoder) AddComplex128(key string, val complex128) { - enc.addKey(key) - enc.AppendComplex128(val) -} - -func (enc *jsonEncoder) AddDuration(key string, val time.Duration) { - enc.addKey(key) - enc.AppendDuration(val) -} - -func (enc *jsonEncoder) AddFloat64(key string, val float64) { - enc.addKey(key) - enc.AppendFloat64(val) -} - -func (enc *jsonEncoder) AddInt64(key string, val int64) { - enc.addKey(key) - enc.AppendInt64(val) -} - -func (enc *jsonEncoder) resetReflectBuf() { - if enc.reflectBuf == nil { - enc.reflectBuf = bufferpool.Get() - enc.reflectEnc = json.NewEncoder(enc.reflectBuf) - } else { - enc.reflectBuf.Reset() - } -} - -func (enc *jsonEncoder) AddReflected(key string, obj interface{}) error { - enc.resetReflectBuf() - err := enc.reflectEnc.Encode(obj) - if err != nil { - return err - } - enc.reflectBuf.TrimNewline() - enc.addKey(key) - _, err = enc.buf.Write(enc.reflectBuf.Bytes()) - return err -} - -func (enc *jsonEncoder) OpenNamespace(key string) { - enc.addKey(key) - enc.buf.AppendByte('{') - enc.openNamespaces++ -} - -func (enc *jsonEncoder) AddString(key, val string) { - enc.addKey(key) - enc.AppendString(val) -} - -func (enc *jsonEncoder) AddTime(key string, val time.Time) { - enc.addKey(key) - enc.AppendTime(val) -} - -func (enc *jsonEncoder) AddUint64(key string, val uint64) { - enc.addKey(key) - enc.AppendUint64(val) -} - -func (enc *jsonEncoder) AppendArray(arr ArrayMarshaler) error { - enc.addElementSeparator() - enc.buf.AppendByte('[') - err := arr.MarshalLogArray(enc) - enc.buf.AppendByte(']') - return err -} - -func (enc *jsonEncoder) AppendObject(obj ObjectMarshaler) error { - enc.addElementSeparator() - enc.buf.AppendByte('{') - err := obj.MarshalLogObject(enc) - enc.buf.AppendByte('}') - return err -} - -func (enc *jsonEncoder) AppendBool(val bool) { - enc.addElementSeparator() - enc.buf.AppendBool(val) -} - -func (enc *jsonEncoder) AppendByteString(val []byte) { - enc.addElementSeparator() - enc.buf.AppendByte('"') - enc.safeAddByteString(val) - enc.buf.AppendByte('"') -} - -func (enc *jsonEncoder) AppendComplex128(val complex128) { - enc.addElementSeparator() - // Cast to a platform-independent, fixed-size type. - r, i := float64(real(val)), float64(imag(val)) - enc.buf.AppendByte('"') - // Because we're always in a quoted string, we can use strconv without - // special-casing NaN and +/-Inf. - enc.buf.AppendFloat(r, 64) - enc.buf.AppendByte('+') - enc.buf.AppendFloat(i, 64) - enc.buf.AppendByte('i') - enc.buf.AppendByte('"') -} - -func (enc *jsonEncoder) AppendDuration(val time.Duration) { - cur := enc.buf.Len() - enc.EncodeDuration(val, enc) - if cur == enc.buf.Len() { - // User-supplied EncodeDuration is a no-op. Fall back to nanoseconds to keep - // JSON valid. - enc.AppendInt64(int64(val)) - } -} - -func (enc *jsonEncoder) AppendInt64(val int64) { - enc.addElementSeparator() - enc.buf.AppendInt(val) -} - -func (enc *jsonEncoder) AppendReflected(val interface{}) error { - enc.resetReflectBuf() - err := enc.reflectEnc.Encode(val) - if err != nil { - return err - } - enc.reflectBuf.TrimNewline() - enc.addElementSeparator() - _, err = enc.buf.Write(enc.reflectBuf.Bytes()) - return err -} - -func (enc *jsonEncoder) AppendString(val string) { - enc.addElementSeparator() - enc.buf.AppendByte('"') - enc.safeAddString(val) - enc.buf.AppendByte('"') -} - -func (enc *jsonEncoder) AppendTime(val time.Time) { - cur := enc.buf.Len() - enc.EncodeTime(val, enc) - if cur == enc.buf.Len() { - // User-supplied EncodeTime is a no-op. Fall back to nanos since epoch to keep - // output JSON valid. - enc.AppendInt64(val.UnixNano()) - } -} - -func (enc *jsonEncoder) AppendUint64(val uint64) { - enc.addElementSeparator() - enc.buf.AppendUint(val) -} - -func (enc *jsonEncoder) AddComplex64(k string, v complex64) { enc.AddComplex128(k, complex128(v)) } -func (enc *jsonEncoder) AddFloat32(k string, v float32) { enc.AddFloat64(k, float64(v)) } -func (enc *jsonEncoder) AddInt(k string, v int) { enc.AddInt64(k, int64(v)) } -func (enc *jsonEncoder) AddInt32(k string, v int32) { enc.AddInt64(k, int64(v)) } -func (enc *jsonEncoder) AddInt16(k string, v int16) { enc.AddInt64(k, int64(v)) } -func (enc *jsonEncoder) AddInt8(k string, v int8) { enc.AddInt64(k, int64(v)) } -func (enc *jsonEncoder) AddUint(k string, v uint) { enc.AddUint64(k, uint64(v)) } -func (enc *jsonEncoder) AddUint32(k string, v uint32) { enc.AddUint64(k, uint64(v)) } -func (enc *jsonEncoder) AddUint16(k string, v uint16) { enc.AddUint64(k, uint64(v)) } -func (enc *jsonEncoder) AddUint8(k string, v uint8) { enc.AddUint64(k, uint64(v)) } -func (enc *jsonEncoder) AddUintptr(k string, v uintptr) { enc.AddUint64(k, uint64(v)) } -func (enc *jsonEncoder) AppendComplex64(v complex64) { enc.AppendComplex128(complex128(v)) } -func (enc *jsonEncoder) AppendFloat64(v float64) { enc.appendFloat(v, 64) } -func (enc *jsonEncoder) AppendFloat32(v float32) { enc.appendFloat(float64(v), 32) } -func (enc *jsonEncoder) AppendInt(v int) { enc.AppendInt64(int64(v)) } -func (enc *jsonEncoder) AppendInt32(v int32) { enc.AppendInt64(int64(v)) } -func (enc *jsonEncoder) AppendInt16(v int16) { enc.AppendInt64(int64(v)) } -func (enc *jsonEncoder) AppendInt8(v int8) { enc.AppendInt64(int64(v)) } -func (enc *jsonEncoder) AppendUint(v uint) { enc.AppendUint64(uint64(v)) } -func (enc *jsonEncoder) AppendUint32(v uint32) { enc.AppendUint64(uint64(v)) } -func (enc *jsonEncoder) AppendUint16(v uint16) { enc.AppendUint64(uint64(v)) } -func (enc *jsonEncoder) AppendUint8(v uint8) { enc.AppendUint64(uint64(v)) } -func (enc *jsonEncoder) AppendUintptr(v uintptr) { enc.AppendUint64(uint64(v)) } - -func (enc *jsonEncoder) Clone() Encoder { - clone := enc.clone() - clone.buf.Write(enc.buf.Bytes()) - return clone -} - -func (enc *jsonEncoder) clone() *jsonEncoder { - clone := getJSONEncoder() - clone.EncoderConfig = enc.EncoderConfig - clone.spaced = enc.spaced - clone.openNamespaces = enc.openNamespaces - clone.buf = bufferpool.Get() - return clone -} - -func (enc *jsonEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, error) { - final := enc.clone() - final.buf.AppendByte('{') - - if final.LevelKey != "" { - final.addKey(final.LevelKey) - cur := final.buf.Len() - final.EncodeLevel(ent.Level, final) - if cur == final.buf.Len() { - // User-supplied EncodeLevel was a no-op. Fall back to strings to keep - // output JSON valid. - final.AppendString(ent.Level.String()) - } - } - if final.TimeKey != "" { - final.AddTime(final.TimeKey, ent.Time) - } - if ent.LoggerName != "" && final.NameKey != "" { - final.addKey(final.NameKey) - cur := final.buf.Len() - nameEncoder := final.EncodeName - - // if no name encoder provided, fall back to FullNameEncoder for backwards - // compatibility - if nameEncoder == nil { - nameEncoder = FullNameEncoder - } - - nameEncoder(ent.LoggerName, final) - if cur == final.buf.Len() { - // User-supplied EncodeName was a no-op. Fall back to strings to - // keep output JSON valid. - final.AppendString(ent.LoggerName) - } - } - if ent.Caller.Defined && final.CallerKey != "" { - final.addKey(final.CallerKey) - cur := final.buf.Len() - final.EncodeCaller(ent.Caller, final) - if cur == final.buf.Len() { - // User-supplied EncodeCaller was a no-op. Fall back to strings to - // keep output JSON valid. - final.AppendString(ent.Caller.String()) - } - } - if final.MessageKey != "" { - final.addKey(enc.MessageKey) - final.AppendString(ent.Message) - } - if enc.buf.Len() > 0 { - final.addElementSeparator() - final.buf.Write(enc.buf.Bytes()) - } - addFields(final, fields) - final.closeOpenNamespaces() - if ent.Stack != "" && final.StacktraceKey != "" { - final.AddString(final.StacktraceKey, ent.Stack) - } - final.buf.AppendByte('}') - if final.LineEnding != "" { - final.buf.AppendString(final.LineEnding) - } else { - final.buf.AppendString(DefaultLineEnding) - } - - ret := final.buf - putJSONEncoder(final) - return ret, nil -} - -func (enc *jsonEncoder) truncate() { - enc.buf.Reset() -} - -func (enc *jsonEncoder) closeOpenNamespaces() { - for i := 0; i < enc.openNamespaces; i++ { - enc.buf.AppendByte('}') - } -} - -func (enc *jsonEncoder) addKey(key string) { - enc.addElementSeparator() - enc.buf.AppendByte('"') - enc.safeAddString(key) - enc.buf.AppendByte('"') - enc.buf.AppendByte(':') - if enc.spaced { - enc.buf.AppendByte(' ') - } -} - -func (enc *jsonEncoder) addElementSeparator() { - last := enc.buf.Len() - 1 - if last < 0 { - return - } - switch enc.buf.Bytes()[last] { - case '{', '[', ':', ',', ' ': - return - default: - enc.buf.AppendByte(',') - if enc.spaced { - enc.buf.AppendByte(' ') - } - } -} - -func (enc *jsonEncoder) appendFloat(val float64, bitSize int) { - enc.addElementSeparator() - switch { - case math.IsNaN(val): - enc.buf.AppendString(`"NaN"`) - case math.IsInf(val, 1): - enc.buf.AppendString(`"+Inf"`) - case math.IsInf(val, -1): - enc.buf.AppendString(`"-Inf"`) - default: - enc.buf.AppendFloat(val, bitSize) - } -} - -// safeAddString JSON-escapes a string and appends it to the internal buffer. -// Unlike the standard library's encoder, it doesn't attempt to protect the -// user from browser vulnerabilities or JSONP-related problems. -func (enc *jsonEncoder) safeAddString(s string) { - for i := 0; i < len(s); { - if enc.tryAddRuneSelf(s[i]) { - i++ - continue - } - r, size := utf8.DecodeRuneInString(s[i:]) - if enc.tryAddRuneError(r, size) { - i++ - continue - } - enc.buf.AppendString(s[i : i+size]) - i += size - } -} - -// safeAddByteString is no-alloc equivalent of safeAddString(string(s)) for s []byte. -func (enc *jsonEncoder) safeAddByteString(s []byte) { - for i := 0; i < len(s); { - if enc.tryAddRuneSelf(s[i]) { - i++ - continue - } - r, size := utf8.DecodeRune(s[i:]) - if enc.tryAddRuneError(r, size) { - i++ - continue - } - enc.buf.Write(s[i : i+size]) - i += size - } -} - -// tryAddRuneSelf appends b if it is valid UTF-8 character represented in a single byte. -func (enc *jsonEncoder) tryAddRuneSelf(b byte) bool { - if b >= utf8.RuneSelf { - return false - } - if 0x20 <= b && b != '\\' && b != '"' { - enc.buf.AppendByte(b) - return true - } - switch b { - case '\\', '"': - enc.buf.AppendByte('\\') - enc.buf.AppendByte(b) - case '\n': - enc.buf.AppendByte('\\') - enc.buf.AppendByte('n') - case '\r': - enc.buf.AppendByte('\\') - enc.buf.AppendByte('r') - case '\t': - enc.buf.AppendByte('\\') - enc.buf.AppendByte('t') - default: - // Encode bytes < 0x20, except for the escape sequences above. - enc.buf.AppendString(`\u00`) - enc.buf.AppendByte(_hex[b>>4]) - enc.buf.AppendByte(_hex[b&0xF]) - } - return true -} - -func (enc *jsonEncoder) tryAddRuneError(r rune, size int) bool { - if r == utf8.RuneError && size == 1 { - enc.buf.AppendString(`\ufffd`) - return true - } - return false -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/level.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/level.go deleted file mode 100644 index e575c9f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/level.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "bytes" - "errors" - "fmt" -) - -var errUnmarshalNilLevel = errors.New("can't unmarshal a nil *Level") - -// A Level is a logging priority. Higher levels are more important. -type Level int8 - -const ( - // DebugLevel logs are typically voluminous, and are usually disabled in - // production. - DebugLevel Level = iota - 1 - // InfoLevel is the default logging priority. - InfoLevel - // WarnLevel logs are more important than Info, but don't need individual - // human review. - WarnLevel - // ErrorLevel logs are high-priority. If an application is running smoothly, - // it shouldn't generate any error-level logs. - ErrorLevel - // DPanicLevel logs are particularly important errors. In development the - // logger panics after writing the message. - DPanicLevel - // PanicLevel logs a message, then panics. - PanicLevel - // FatalLevel logs a message, then calls os.Exit(1). - FatalLevel - - _minLevel = DebugLevel - _maxLevel = FatalLevel -) - -// String returns a lower-case ASCII representation of the log level. -func (l Level) String() string { - switch l { - case DebugLevel: - return "debug" - case InfoLevel: - return "info" - case WarnLevel: - return "warn" - case ErrorLevel: - return "error" - case DPanicLevel: - return "dpanic" - case PanicLevel: - return "panic" - case FatalLevel: - return "fatal" - default: - return fmt.Sprintf("Level(%d)", l) - } -} - -// CapitalString returns an all-caps ASCII representation of the log level. -func (l Level) CapitalString() string { - // Printing levels in all-caps is common enough that we should export this - // functionality. - switch l { - case DebugLevel: - return "DEBUG" - case InfoLevel: - return "INFO" - case WarnLevel: - return "WARN" - case ErrorLevel: - return "ERROR" - case DPanicLevel: - return "DPANIC" - case PanicLevel: - return "PANIC" - case FatalLevel: - return "FATAL" - default: - return fmt.Sprintf("LEVEL(%d)", l) - } -} - -// MarshalText marshals the Level to text. Note that the text representation -// drops the -Level suffix (see example). -func (l Level) MarshalText() ([]byte, error) { - return []byte(l.String()), nil -} - -// UnmarshalText unmarshals text to a level. Like MarshalText, UnmarshalText -// expects the text representation of a Level to drop the -Level suffix (see -// example). -// -// In particular, this makes it easy to configure logging levels using YAML, -// TOML, or JSON files. -func (l *Level) UnmarshalText(text []byte) error { - if l == nil { - return errUnmarshalNilLevel - } - if !l.unmarshalText(text) && !l.unmarshalText(bytes.ToLower(text)) { - return fmt.Errorf("unrecognized level: %q", text) - } - return nil -} - -func (l *Level) unmarshalText(text []byte) bool { - switch string(text) { - case "debug", "DEBUG": - *l = DebugLevel - case "info", "INFO", "": // make the zero value useful - *l = InfoLevel - case "warn", "WARN": - *l = WarnLevel - case "error", "ERROR": - *l = ErrorLevel - case "dpanic", "DPANIC": - *l = DPanicLevel - case "panic", "PANIC": - *l = PanicLevel - case "fatal", "FATAL": - *l = FatalLevel - default: - return false - } - return true -} - -// Set sets the level for the flag.Value interface. -func (l *Level) Set(s string) error { - return l.UnmarshalText([]byte(s)) -} - -// Get gets the level for the flag.Getter interface. -func (l *Level) Get() interface{} { - return *l -} - -// Enabled returns true if the given level is at or above this level. -func (l Level) Enabled(lvl Level) bool { - return lvl >= l -} - -// LevelEnabler decides whether a given logging level is enabled when logging a -// message. -// -// Enablers are intended to be used to implement deterministic filters; -// concerns like sampling are better implemented as a Core. -// -// Each concrete Level value implements a static LevelEnabler which returns -// true for itself and all higher logging levels. For example WarnLevel.Enabled() -// will return true for WarnLevel, ErrorLevel, DPanicLevel, PanicLevel, and -// FatalLevel, but return false for InfoLevel and DebugLevel. -type LevelEnabler interface { - Enabled(Level) bool -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/level_strings.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/level_strings.go deleted file mode 100644 index 7af8dad..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/level_strings.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import "go.uber.org/zap/internal/color" - -var ( - _levelToColor = map[Level]color.Color{ - DebugLevel: color.Magenta, - InfoLevel: color.Blue, - WarnLevel: color.Yellow, - ErrorLevel: color.Red, - DPanicLevel: color.Red, - PanicLevel: color.Red, - FatalLevel: color.Red, - } - _unknownLevelColor = color.Red - - _levelToLowercaseColorString = make(map[Level]string, len(_levelToColor)) - _levelToCapitalColorString = make(map[Level]string, len(_levelToColor)) -) - -func init() { - for level, color := range _levelToColor { - _levelToLowercaseColorString[level] = color.Add(level.String()) - _levelToCapitalColorString[level] = color.Add(level.CapitalString()) - } -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/marshaler.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/marshaler.go deleted file mode 100644 index 2627a65..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/marshaler.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -// ObjectMarshaler allows user-defined types to efficiently add themselves to the -// logging context, and to selectively omit information which shouldn't be -// included in logs (e.g., passwords). -type ObjectMarshaler interface { - MarshalLogObject(ObjectEncoder) error -} - -// ObjectMarshalerFunc is a type adapter that turns a function into an -// ObjectMarshaler. -type ObjectMarshalerFunc func(ObjectEncoder) error - -// MarshalLogObject calls the underlying function. -func (f ObjectMarshalerFunc) MarshalLogObject(enc ObjectEncoder) error { - return f(enc) -} - -// ArrayMarshaler allows user-defined types to efficiently add themselves to the -// logging context, and to selectively omit information which shouldn't be -// included in logs (e.g., passwords). -type ArrayMarshaler interface { - MarshalLogArray(ArrayEncoder) error -} - -// ArrayMarshalerFunc is a type adapter that turns a function into an -// ArrayMarshaler. -type ArrayMarshalerFunc func(ArrayEncoder) error - -// MarshalLogArray calls the underlying function. -func (f ArrayMarshalerFunc) MarshalLogArray(enc ArrayEncoder) error { - return f(enc) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/memory_encoder.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/memory_encoder.go deleted file mode 100644 index 6ef85b0..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/memory_encoder.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import "time" - -// MapObjectEncoder is an ObjectEncoder backed by a simple -// map[string]interface{}. It's not fast enough for production use, but it's -// helpful in tests. -type MapObjectEncoder struct { - // Fields contains the entire encoded log context. - Fields map[string]interface{} - // cur is a pointer to the namespace we're currently writing to. - cur map[string]interface{} -} - -// NewMapObjectEncoder creates a new map-backed ObjectEncoder. -func NewMapObjectEncoder() *MapObjectEncoder { - m := make(map[string]interface{}) - return &MapObjectEncoder{ - Fields: m, - cur: m, - } -} - -// AddArray implements ObjectEncoder. -func (m *MapObjectEncoder) AddArray(key string, v ArrayMarshaler) error { - arr := &sliceArrayEncoder{elems: make([]interface{}, 0)} - err := v.MarshalLogArray(arr) - m.cur[key] = arr.elems - return err -} - -// AddObject implements ObjectEncoder. -func (m *MapObjectEncoder) AddObject(k string, v ObjectMarshaler) error { - newMap := NewMapObjectEncoder() - m.cur[k] = newMap.Fields - return v.MarshalLogObject(newMap) -} - -// AddBinary implements ObjectEncoder. -func (m *MapObjectEncoder) AddBinary(k string, v []byte) { m.cur[k] = v } - -// AddByteString implements ObjectEncoder. -func (m *MapObjectEncoder) AddByteString(k string, v []byte) { m.cur[k] = string(v) } - -// AddBool implements ObjectEncoder. -func (m *MapObjectEncoder) AddBool(k string, v bool) { m.cur[k] = v } - -// AddDuration implements ObjectEncoder. -func (m MapObjectEncoder) AddDuration(k string, v time.Duration) { m.cur[k] = v } - -// AddComplex128 implements ObjectEncoder. -func (m *MapObjectEncoder) AddComplex128(k string, v complex128) { m.cur[k] = v } - -// AddComplex64 implements ObjectEncoder. -func (m *MapObjectEncoder) AddComplex64(k string, v complex64) { m.cur[k] = v } - -// AddFloat64 implements ObjectEncoder. -func (m *MapObjectEncoder) AddFloat64(k string, v float64) { m.cur[k] = v } - -// AddFloat32 implements ObjectEncoder. -func (m *MapObjectEncoder) AddFloat32(k string, v float32) { m.cur[k] = v } - -// AddInt implements ObjectEncoder. -func (m *MapObjectEncoder) AddInt(k string, v int) { m.cur[k] = v } - -// AddInt64 implements ObjectEncoder. -func (m *MapObjectEncoder) AddInt64(k string, v int64) { m.cur[k] = v } - -// AddInt32 implements ObjectEncoder. -func (m *MapObjectEncoder) AddInt32(k string, v int32) { m.cur[k] = v } - -// AddInt16 implements ObjectEncoder. -func (m *MapObjectEncoder) AddInt16(k string, v int16) { m.cur[k] = v } - -// AddInt8 implements ObjectEncoder. -func (m *MapObjectEncoder) AddInt8(k string, v int8) { m.cur[k] = v } - -// AddString implements ObjectEncoder. -func (m *MapObjectEncoder) AddString(k string, v string) { m.cur[k] = v } - -// AddTime implements ObjectEncoder. -func (m MapObjectEncoder) AddTime(k string, v time.Time) { m.cur[k] = v } - -// AddUint implements ObjectEncoder. -func (m *MapObjectEncoder) AddUint(k string, v uint) { m.cur[k] = v } - -// AddUint64 implements ObjectEncoder. -func (m *MapObjectEncoder) AddUint64(k string, v uint64) { m.cur[k] = v } - -// AddUint32 implements ObjectEncoder. -func (m *MapObjectEncoder) AddUint32(k string, v uint32) { m.cur[k] = v } - -// AddUint16 implements ObjectEncoder. -func (m *MapObjectEncoder) AddUint16(k string, v uint16) { m.cur[k] = v } - -// AddUint8 implements ObjectEncoder. -func (m *MapObjectEncoder) AddUint8(k string, v uint8) { m.cur[k] = v } - -// AddUintptr implements ObjectEncoder. -func (m *MapObjectEncoder) AddUintptr(k string, v uintptr) { m.cur[k] = v } - -// AddReflected implements ObjectEncoder. -func (m *MapObjectEncoder) AddReflected(k string, v interface{}) error { - m.cur[k] = v - return nil -} - -// OpenNamespace implements ObjectEncoder. -func (m *MapObjectEncoder) OpenNamespace(k string) { - ns := make(map[string]interface{}) - m.cur[k] = ns - m.cur = ns -} - -// sliceArrayEncoder is an ArrayEncoder backed by a simple []interface{}. Like -// the MapObjectEncoder, it's not designed for production use. -type sliceArrayEncoder struct { - elems []interface{} -} - -func (s *sliceArrayEncoder) AppendArray(v ArrayMarshaler) error { - enc := &sliceArrayEncoder{} - err := v.MarshalLogArray(enc) - s.elems = append(s.elems, enc.elems) - return err -} - -func (s *sliceArrayEncoder) AppendObject(v ObjectMarshaler) error { - m := NewMapObjectEncoder() - err := v.MarshalLogObject(m) - s.elems = append(s.elems, m.Fields) - return err -} - -func (s *sliceArrayEncoder) AppendReflected(v interface{}) error { - s.elems = append(s.elems, v) - return nil -} - -func (s *sliceArrayEncoder) AppendBool(v bool) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendByteString(v []byte) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendComplex128(v complex128) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendComplex64(v complex64) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendDuration(v time.Duration) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendFloat64(v float64) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendFloat32(v float32) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendInt(v int) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendInt64(v int64) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendInt32(v int32) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendInt16(v int16) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendInt8(v int8) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendString(v string) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendTime(v time.Time) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendUint(v uint) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendUint64(v uint64) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendUint32(v uint32) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendUint16(v uint16) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendUint8(v uint8) { s.elems = append(s.elems, v) } -func (s *sliceArrayEncoder) AppendUintptr(v uintptr) { s.elems = append(s.elems, v) } diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/sampler.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/sampler.go deleted file mode 100644 index e316418..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/sampler.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "time" - - "go.uber.org/atomic" -) - -const ( - _numLevels = _maxLevel - _minLevel + 1 - _countersPerLevel = 4096 -) - -type counter struct { - resetAt atomic.Int64 - counter atomic.Uint64 -} - -type counters [_numLevels][_countersPerLevel]counter - -func newCounters() *counters { - return &counters{} -} - -func (cs *counters) get(lvl Level, key string) *counter { - i := lvl - _minLevel - j := fnv32a(key) % _countersPerLevel - return &cs[i][j] -} - -// fnv32a, adapted from "hash/fnv", but without a []byte(string) alloc -func fnv32a(s string) uint32 { - const ( - offset32 = 2166136261 - prime32 = 16777619 - ) - hash := uint32(offset32) - for i := 0; i < len(s); i++ { - hash ^= uint32(s[i]) - hash *= prime32 - } - return hash -} - -func (c *counter) IncCheckReset(t time.Time, tick time.Duration) uint64 { - tn := t.UnixNano() - resetAfter := c.resetAt.Load() - if resetAfter > tn { - return c.counter.Inc() - } - - c.counter.Store(1) - - newResetAfter := tn + tick.Nanoseconds() - if !c.resetAt.CAS(resetAfter, newResetAfter) { - // We raced with another goroutine trying to reset, and it also reset - // the counter to 1, so we need to reincrement the counter. - return c.counter.Inc() - } - - return 1 -} - -type sampler struct { - Core - - counts *counters - tick time.Duration - first, thereafter uint64 -} - -// NewSampler creates a Core that samples incoming entries, which caps the CPU -// and I/O load of logging while attempting to preserve a representative subset -// of your logs. -// -// Zap samples by logging the first N entries with a given level and message -// each tick. If more Entries with the same level and message are seen during -// the same interval, every Mth message is logged and the rest are dropped. -// -// Keep in mind that zap's sampling implementation is optimized for speed over -// absolute precision; under load, each tick may be slightly over- or -// under-sampled. -func NewSampler(core Core, tick time.Duration, first, thereafter int) Core { - return &sampler{ - Core: core, - tick: tick, - counts: newCounters(), - first: uint64(first), - thereafter: uint64(thereafter), - } -} - -func (s *sampler) With(fields []Field) Core { - return &sampler{ - Core: s.Core.With(fields), - tick: s.tick, - counts: s.counts, - first: s.first, - thereafter: s.thereafter, - } -} - -func (s *sampler) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { - if !s.Enabled(ent.Level) { - return ce - } - - counter := s.counts.get(ent.Level, ent.Message) - n := counter.IncCheckReset(ent.Time, s.tick) - if n > s.first && (n-s.first)%s.thereafter != 0 { - return ce - } - return s.Core.Check(ent, ce) -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/tee.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/tee.go deleted file mode 100644 index 07a32ee..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/tee.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import "go.uber.org/multierr" - -type multiCore []Core - -// NewTee creates a Core that duplicates log entries into two or more -// underlying Cores. -// -// Calling it with a single Core returns the input unchanged, and calling -// it with no input returns a no-op Core. -func NewTee(cores ...Core) Core { - switch len(cores) { - case 0: - return NewNopCore() - case 1: - return cores[0] - default: - return multiCore(cores) - } -} - -func (mc multiCore) With(fields []Field) Core { - clone := make(multiCore, len(mc)) - for i := range mc { - clone[i] = mc[i].With(fields) - } - return clone -} - -func (mc multiCore) Enabled(lvl Level) bool { - for i := range mc { - if mc[i].Enabled(lvl) { - return true - } - } - return false -} - -func (mc multiCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { - for i := range mc { - ce = mc[i].Check(ent, ce) - } - return ce -} - -func (mc multiCore) Write(ent Entry, fields []Field) error { - var err error - for i := range mc { - err = multierr.Append(err, mc[i].Write(ent, fields)) - } - return err -} - -func (mc multiCore) Sync() error { - var err error - for i := range mc { - err = multierr.Append(err, mc[i].Sync()) - } - return err -} diff --git a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/write_syncer.go b/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/write_syncer.go deleted file mode 100644 index 209e25f..0000000 --- a/e2e/gortc-turn/turn-client/vendor/go.uber.org/zap/zapcore/write_syncer.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// 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. - -package zapcore - -import ( - "io" - "sync" - - "go.uber.org/multierr" -) - -// A WriteSyncer is an io.Writer that can also flush any buffered data. Note -// that *os.File (and thus, os.Stderr and os.Stdout) implement WriteSyncer. -type WriteSyncer interface { - io.Writer - Sync() error -} - -// AddSync converts an io.Writer to a WriteSyncer. It attempts to be -// intelligent: if the concrete type of the io.Writer implements WriteSyncer, -// we'll use the existing Sync method. If it doesn't, we'll add a no-op Sync. -func AddSync(w io.Writer) WriteSyncer { - switch w := w.(type) { - case WriteSyncer: - return w - default: - return writerWrapper{w} - } -} - -type lockedWriteSyncer struct { - sync.Mutex - ws WriteSyncer -} - -// Lock wraps a WriteSyncer in a mutex to make it safe for concurrent use. In -// particular, *os.Files must be locked before use. -func Lock(ws WriteSyncer) WriteSyncer { - if _, ok := ws.(*lockedWriteSyncer); ok { - // no need to layer on another lock - return ws - } - return &lockedWriteSyncer{ws: ws} -} - -func (s *lockedWriteSyncer) Write(bs []byte) (int, error) { - s.Lock() - n, err := s.ws.Write(bs) - s.Unlock() - return n, err -} - -func (s *lockedWriteSyncer) Sync() error { - s.Lock() - err := s.ws.Sync() - s.Unlock() - return err -} - -type writerWrapper struct { - io.Writer -} - -func (w writerWrapper) Sync() error { - return nil -} - -type multiWriteSyncer []WriteSyncer - -// NewMultiWriteSyncer creates a WriteSyncer that duplicates its writes -// and sync calls, much like io.MultiWriter. -func NewMultiWriteSyncer(ws ...WriteSyncer) WriteSyncer { - if len(ws) == 1 { - return ws[0] - } - // Copy to protect against https://github.com/golang/go/issues/7809 - return multiWriteSyncer(append([]WriteSyncer(nil), ws...)) -} - -// See https://golang.org/src/io/multi.go -// When not all underlying syncers write the same number of bytes, -// the smallest number is returned even though Write() is called on -// all of them. -func (ws multiWriteSyncer) Write(p []byte) (int, error) { - var writeErr error - nWritten := 0 - for _, w := range ws { - n, err := w.Write(p) - writeErr = multierr.Append(writeErr, err) - if nWritten == 0 && n != 0 { - nWritten = n - } else if n < nWritten { - nWritten = n - } - } - return nWritten, writeErr -} - -func (ws multiWriteSyncer) Sync() error { - var err error - for _, w := range ws { - err = multierr.Append(err, w.Sync()) - } - return err -} diff --git a/e2e/webrtc-chrome/Gopkg.lock b/e2e/webrtc-chrome/Gopkg.lock deleted file mode 100644 index 25aa0a3..0000000 --- a/e2e/webrtc-chrome/Gopkg.lock +++ /dev/null @@ -1,169 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - digest = "1:fe2d0a514c084b6c37d60a1b89707a51562f797c19b495027531aecb45971549" - name = "github.com/chromedp/cdproto" - packages = [ - ".", - "accessibility", - "animation", - "applicationcache", - "audits", - "browser", - "cachestorage", - "cdp", - "css", - "database", - "debugger", - "deviceorientation", - "dom", - "domdebugger", - "domsnapshot", - "domstorage", - "emulation", - "headlessexperimental", - "heapprofiler", - "indexeddb", - "input", - "inspector", - "io", - "layertree", - "log", - "memory", - "network", - "overlay", - "page", - "performance", - "profiler", - "runtime", - "security", - "serviceworker", - "storage", - "systeminfo", - "target", - "tethering", - "tracing", - ] - pruneopts = "UT" - revision = "b8925c84f3c48b5871161947c2480fc40972248e" - -[[projects]] - digest = "1:13e2ffaa15cf117544a44b046c0438063047ee1b963ef9312ce7758c27cdaebc" - name = "github.com/chromedp/chromedp" - packages = [ - ".", - "client", - "kb", - "runner", - ] - pruneopts = "UT" - revision = "34591780d9d429c470ccf81a2760c40245fc823a" - version = "v0.1.2" - -[[projects]] - digest = "1:256dd949e34358cbf396484da03e028e3c004a7a031d59892aef0a101fa0a01c" - name = "github.com/disintegration/imaging" - packages = ["."] - pruneopts = "UT" - revision = "bbcee2f5c9d5e94ca42c8b50ec847fec64a6c134" - version = "v1.4.2" - -[[projects]] - digest = "1:318f1c959a8a740366fce4b1e1eb2fd914036b4af58fbd0a003349b305f118ad" - name = "github.com/golang/protobuf" - packages = ["proto"] - pruneopts = "UT" - revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" - version = "v1.3.1" - -[[projects]] - digest = "1:43dd08a10854b2056e615d1b1d22ac94559d822e1f8b6fcc92c1a1057e85188e" - name = "github.com/gorilla/websocket" - packages = ["."] - pruneopts = "UT" - revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b" - version = "v1.2.0" - -[[projects]] - branch = "master" - digest = "1:901625a0300fa83074dcf2510424c26a19dc3edadf67b34ca45a78f879ac4b0c" - name = "github.com/knq/snaker" - packages = ["."] - pruneopts = "UT" - revision = "d9ad1e7f342a5b58202aa92c5f1106d7bb8b9c73" - -[[projects]] - branch = "master" - digest = "1:4bc4b80749499a818176b07698dc72025610f5570168a47a94ffd38709e4a5f0" - name = "github.com/knq/sysutil" - packages = ["."] - pruneopts = "UT" - revision = "0218e141a794643e8c0fa283b9cd076fc0df662d" - -[[projects]] - branch = "master" - digest = "1:aa3d8d42865c42626b5c1add193692d045b3188b1479f0a0a88690d21fe20083" - name = "github.com/mailru/easyjson" - packages = [ - ".", - "buffer", - "jlexer", - "jwriter", - ] - pruneopts = "UT" - revision = "03f2033d19d5860aef995fe360ac7d395cd8ce65" - -[[projects]] - digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" - name = "github.com/matttproud/golang_protobuf_extensions" - packages = ["pbutil"] - pruneopts = "UT" - revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" - version = "v1.0.1" - -[[projects]] - branch = "master" - digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4" - name = "github.com/prometheus/client_model" - packages = ["go"] - pruneopts = "UT" - revision = "fd36f4220a901265f90734c3183c5f0c91daa0b8" - -[[projects]] - digest = "1:35cf6bdf68db765988baa9c4f10cc5d7dda1126a54bd62e252dbcd0b1fc8da90" - name = "github.com/prometheus/common" - packages = [ - "expfmt", - "internal/bitbucket.org/ww/goautoneg", - "model", - ] - pruneopts = "UT" - revision = "a82f4c12f983cc2649298185f296632953e50d3e" - version = "v0.3.0" - -[[projects]] - branch = "master" - digest = "1:d3d337e91c35f337d548873978c858ecb723168a6303a41a3ba625c79094f899" - name = "golang.org/x/image" - packages = [ - "bmp", - "tiff", - "tiff/lzw", - ] - pruneopts = "UT" - revision = "c73c2afc3b812cdd6385de5a50616511c4a3d458" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/chromedp/chromedp", - "github.com/chromedp/chromedp/runner", - "github.com/gorilla/websocket", - "github.com/prometheus/client_model/go", - "github.com/prometheus/common/expfmt", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/e2e/webrtc-chrome/Gopkg.toml b/e2e/webrtc-chrome/Gopkg.toml deleted file mode 100644 index c62f51c..0000000 --- a/e2e/webrtc-chrome/Gopkg.toml +++ /dev/null @@ -1,32 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" -# -# [prune] -# non-go = false -# go-tests = true -# unused-packages = true - -ignored = ["github.com/gortc/gortcd"] - -[prune] - go-tests = true - unused-packages = true - diff --git a/e2e/webrtc-chrome/go.mod b/e2e/webrtc-chrome/go.mod new file mode 100644 index 0000000..b57a761 --- /dev/null +++ b/e2e/webrtc-chrome/go.mod @@ -0,0 +1,18 @@ +module github.com/gortc/gortcd/e2e/webrtc-chrome + +go 1.12 + +require ( + github.com/chromedp/cdproto v0.0.0-20180731224315-b8925c84f3c4 + github.com/chromedp/chromedp v0.1.2 + github.com/disintegration/imaging v1.4.2 + github.com/golang/protobuf v1.3.1 + github.com/gorilla/websocket v1.2.0 + github.com/knq/snaker v0.0.0-20180306023312-d9ad1e7f342a + github.com/knq/sysutil v0.0.0-20180306023629-0218e141a794 + github.com/mailru/easyjson v0.0.0-20180730094502-03f2033d19d5 + github.com/matttproud/golang_protobuf_extensions v1.0.1 + github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 + github.com/prometheus/common v0.3.0 + golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 +) diff --git a/e2e/webrtc-chrome/go.sum b/e2e/webrtc-chrome/go.sum new file mode 100644 index 0000000..262e54b --- /dev/null +++ b/e2e/webrtc-chrome/go.sum @@ -0,0 +1,54 @@ +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/chromedp/cdproto v0.0.0-20180713053126-e314dc107013/go.mod h1:C2GPAraqdt1KfZU7aSmx1XUgarNq/3JmxevQkmCjOVs= +github.com/chromedp/cdproto v0.0.0-20180731224315-b8925c84f3c4 h1:KXkQywT4MsPpnEI8Yih8D/xojLGmUtVcGxMMwqIwnYg= +github.com/chromedp/cdproto v0.0.0-20180731224315-b8925c84f3c4/go.mod h1:C2GPAraqdt1KfZU7aSmx1XUgarNq/3JmxevQkmCjOVs= +github.com/chromedp/chromedp v0.1.2 h1:qB/dpbbbOPGkKyZU2gKB49jp+ZvY9C3rPUfYELLz+6g= +github.com/chromedp/chromedp v0.1.2/go.mod h1:83UDY5CKmHrvKLQ6vVU+LVFUcfjOSPNufx8XFWLUYlQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/disintegration/imaging v1.4.2 h1:BSVxoYQ2NfLdvIGCDD8GHgBV5K0FCEsc0d/6FxQII3I= +github.com/disintegration/imaging v1.4.2/go.mod h1:9B/deIUIrliYkyMTuXJd6OUFLcrZ2tf+3Qlwnaf/CjU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= +github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/knq/snaker v0.0.0-20180306023312-d9ad1e7f342a/go.mod h1:f0Dmq8fkddh8nOsVabYmtOHHdxlq2q4X+LQ1xWQEdUU= +github.com/knq/sysutil v0.0.0-20180306023629-0218e141a794 h1:hgWKTlyruPI7k8W+0FmTMLf+8d2KPxyzTxsfDDQhNp8= +github.com/knq/sysutil v0.0.0-20180306023629-0218e141a794/go.mod h1:BjPj+aVjl9FW/cCGiF3nGh5v+9Gd3VCgBQbod/GlMaQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/mailru/easyjson v0.0.0-20180606163543-3fdea8d05856/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20180730094502-03f2033d19d5 h1:0x4qcEHDpruK6ML/m/YSlFUUu0UpRD3I2PHsNCuGnyA= +github.com/mailru/easyjson v0.0.0-20180730094502-03f2033d19d5/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.3.0 h1:taZ4h8Tkxv2kNyoSctBvfXEHmBmxrwmIidZTIaHons4= +github.com/prometheus/common v0.3.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/.gitignore b/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/.gitignore deleted file mode 100644 index c456f53..0000000 --- a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.json -*.pdl diff --git a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/.travis.yml b/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/.travis.yml deleted file mode 100644 index effd52f..0000000 --- a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go -go: - - 1.10.x - - tip -addons: - apt: - chrome: stable -before_install: - - go get -d github.com/chromedp/chromedp -script: - - go build ./... - - export CHROMEDP_TEST_RUNNER=google-chrome-stable - - export CHROMEDP_DISABLE_GPU=true - - cd $GOPATH/src/github.com/chromedp/chromedp - - go test -v diff --git a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/LICENSE b/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/LICENSE deleted file mode 100644 index 09ca771..0000000 --- a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016-2018 Kenneth Shaw - -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/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/README.md b/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/README.md deleted file mode 100644 index 390b677..0000000 --- a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# About cdproto - -Package `cdproto` contains the generated commands, types, and events for the -[Chrome DevTools Protocol domains][devtools-protocol]. - -This package is generated by the [`cdproto-gen`][cdproto-gen] command. Please -refer to that project and to the main [`chromedp`][chromedp] project for -information on using the commands, types, and events available here. - -## API - -Please see the [GoDoc listing][godoc]. - -## Contributing - -If you would like to submit a change to the code in this package, please submit -your Pull Request to the [`cdproto-gen`][cdproto-gen] project. Any Issues and -Pull Requests submitted to this project will be closed without being reviewed. - -[devtools-protocol]: https://chromedevtools.github.io/devtools-protocol/ -[cdproto-gen]: https://github.com/chromedp/cdproto-gen -[chromedp]: https://github.com/chromedp/chromedp -[godoc]: https://godoc.org/github.com/chromedp/cdproto diff --git a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/accessibility.go b/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/accessibility.go deleted file mode 100644 index 9b17738..0000000 --- a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/accessibility.go +++ /dev/null @@ -1,84 +0,0 @@ -// Package accessibility provides the Chrome DevTools Protocol -// commands, types, and events for the Accessibility domain. -// -// Generated by the cdproto-gen command. -package accessibility - -// Code generated by cdproto-gen. DO NOT EDIT. - -import ( - "context" - - "github.com/chromedp/cdproto/cdp" - "github.com/chromedp/cdproto/runtime" -) - -// GetPartialAXTreeParams fetches the accessibility node and partial -// accessibility tree for this DOM node, if it exists. -type GetPartialAXTreeParams struct { - NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node to get the partial accessibility tree for. - BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node to get the partial accessibility tree for. - ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node wrapper to get the partial accessibility tree for. - FetchRelatives bool `json:"fetchRelatives,omitempty"` // Whether to fetch this nodes ancestors, siblings and children. Defaults to true. -} - -// GetPartialAXTree fetches the accessibility node and partial accessibility -// tree for this DOM node, if it exists. -// -// parameters: -func GetPartialAXTree() *GetPartialAXTreeParams { - return &GetPartialAXTreeParams{} -} - -// WithNodeID identifier of the node to get the partial accessibility tree -// for. -func (p GetPartialAXTreeParams) WithNodeID(nodeID cdp.NodeID) *GetPartialAXTreeParams { - p.NodeID = nodeID - return &p -} - -// WithBackendNodeID identifier of the backend node to get the partial -// accessibility tree for. -func (p GetPartialAXTreeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *GetPartialAXTreeParams { - p.BackendNodeID = backendNodeID - return &p -} - -// WithObjectID JavaScript object id of the node wrapper to get the partial -// accessibility tree for. -func (p GetPartialAXTreeParams) WithObjectID(objectID runtime.RemoteObjectID) *GetPartialAXTreeParams { - p.ObjectID = objectID - return &p -} - -// WithFetchRelatives whether to fetch this nodes ancestors, siblings and -// children. Defaults to true. -func (p GetPartialAXTreeParams) WithFetchRelatives(fetchRelatives bool) *GetPartialAXTreeParams { - p.FetchRelatives = fetchRelatives - return &p -} - -// GetPartialAXTreeReturns return values. -type GetPartialAXTreeReturns struct { - Nodes []*Node `json:"nodes,omitempty"` // The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested. -} - -// Do executes Accessibility.getPartialAXTree against the provided context. -// -// returns: -// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested. -func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.Executor) (nodes []*Node, err error) { - // execute - var res GetPartialAXTreeReturns - err = h.Execute(ctxt, CommandGetPartialAXTree, p, &res) - if err != nil { - return nil, err - } - - return res.Nodes, nil -} - -// Command names. -const ( - CommandGetPartialAXTree = "Accessibility.getPartialAXTree" -) diff --git a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/easyjson.go b/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/easyjson.go deleted file mode 100644 index 4ce4114..0000000 --- a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/easyjson.go +++ /dev/null @@ -1,1137 +0,0 @@ -// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. - -package accessibility - -import ( - json "encoding/json" - runtime "github.com/chromedp/cdproto/runtime" - easyjson "github.com/mailru/easyjson" - jlexer "github.com/mailru/easyjson/jlexer" - jwriter "github.com/mailru/easyjson/jwriter" -) - -// suppress unused package warning -var ( - _ *json.RawMessage - _ *jlexer.Lexer - _ *jwriter.Writer - _ easyjson.Marshaler -) - -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility(in *jlexer.Lexer, out *ValueSource) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - (out.Type).UnmarshalEasyJSON(in) - case "value": - if in.IsNull() { - in.Skip() - out.Value = nil - } else { - if out.Value == nil { - out.Value = new(Value) - } - (*out.Value).UnmarshalEasyJSON(in) - } - case "attribute": - out.Attribute = string(in.String()) - case "attributeValue": - if in.IsNull() { - in.Skip() - out.AttributeValue = nil - } else { - if out.AttributeValue == nil { - out.AttributeValue = new(Value) - } - (*out.AttributeValue).UnmarshalEasyJSON(in) - } - case "superseded": - out.Superseded = bool(in.Bool()) - case "nativeSource": - (out.NativeSource).UnmarshalEasyJSON(in) - case "nativeSourceValue": - if in.IsNull() { - in.Skip() - out.NativeSourceValue = nil - } else { - if out.NativeSourceValue == nil { - out.NativeSourceValue = new(Value) - } - (*out.NativeSourceValue).UnmarshalEasyJSON(in) - } - case "invalid": - out.Invalid = bool(in.Bool()) - case "invalidReason": - out.InvalidReason = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility(out *jwriter.Writer, in ValueSource) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"type\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (in.Type).MarshalEasyJSON(out) - } - if in.Value != nil { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Value).MarshalEasyJSON(out) - } - if in.Attribute != "" { - const prefix string = ",\"attribute\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Attribute)) - } - if in.AttributeValue != nil { - const prefix string = ",\"attributeValue\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.AttributeValue).MarshalEasyJSON(out) - } - if in.Superseded { - const prefix string = ",\"superseded\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.Superseded)) - } - if in.NativeSource != "" { - const prefix string = ",\"nativeSource\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (in.NativeSource).MarshalEasyJSON(out) - } - if in.NativeSourceValue != nil { - const prefix string = ",\"nativeSourceValue\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.NativeSourceValue).MarshalEasyJSON(out) - } - if in.Invalid { - const prefix string = ",\"invalid\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.Invalid)) - } - if in.InvalidReason != "" { - const prefix string = ",\"invalidReason\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.InvalidReason)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v ValueSource) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v ValueSource) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *ValueSource) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *ValueSource) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility(l, v) -} -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility1(in *jlexer.Lexer, out *Value) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - (out.Type).UnmarshalEasyJSON(in) - case "value": - (out.Value).UnmarshalEasyJSON(in) - case "relatedNodes": - if in.IsNull() { - in.Skip() - out.RelatedNodes = nil - } else { - in.Delim('[') - if out.RelatedNodes == nil { - if !in.IsDelim(']') { - out.RelatedNodes = make([]*RelatedNode, 0, 8) - } else { - out.RelatedNodes = []*RelatedNode{} - } - } else { - out.RelatedNodes = (out.RelatedNodes)[:0] - } - for !in.IsDelim(']') { - var v1 *RelatedNode - if in.IsNull() { - in.Skip() - v1 = nil - } else { - if v1 == nil { - v1 = new(RelatedNode) - } - (*v1).UnmarshalEasyJSON(in) - } - out.RelatedNodes = append(out.RelatedNodes, v1) - in.WantComma() - } - in.Delim(']') - } - case "sources": - if in.IsNull() { - in.Skip() - out.Sources = nil - } else { - in.Delim('[') - if out.Sources == nil { - if !in.IsDelim(']') { - out.Sources = make([]*ValueSource, 0, 8) - } else { - out.Sources = []*ValueSource{} - } - } else { - out.Sources = (out.Sources)[:0] - } - for !in.IsDelim(']') { - var v2 *ValueSource - if in.IsNull() { - in.Skip() - v2 = nil - } else { - if v2 == nil { - v2 = new(ValueSource) - } - (*v2).UnmarshalEasyJSON(in) - } - out.Sources = append(out.Sources, v2) - in.WantComma() - } - in.Delim(']') - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility1(out *jwriter.Writer, in Value) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"type\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (in.Type).MarshalEasyJSON(out) - } - if (in.Value).IsDefined() { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (in.Value).MarshalEasyJSON(out) - } - if len(in.RelatedNodes) != 0 { - const prefix string = ",\"relatedNodes\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v3, v4 := range in.RelatedNodes { - if v3 > 0 { - out.RawByte(',') - } - if v4 == nil { - out.RawString("null") - } else { - (*v4).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - if len(in.Sources) != 0 { - const prefix string = ",\"sources\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v5, v6 := range in.Sources { - if v5 > 0 { - out.RawByte(',') - } - if v6 == nil { - out.RawString("null") - } else { - (*v6).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Value) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility1(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Value) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility1(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Value) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility1(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Value) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility1(l, v) -} -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility2(in *jlexer.Lexer, out *RelatedNode) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "backendDOMNodeId": - (out.BackendDOMNodeID).UnmarshalEasyJSON(in) - case "idref": - out.Idref = string(in.String()) - case "text": - out.Text = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility2(out *jwriter.Writer, in RelatedNode) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"backendDOMNodeId\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.BackendDOMNodeID)) - } - if in.Idref != "" { - const prefix string = ",\"idref\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Idref)) - } - if in.Text != "" { - const prefix string = ",\"text\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Text)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v RelatedNode) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility2(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v RelatedNode) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility2(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *RelatedNode) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility2(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *RelatedNode) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility2(l, v) -} -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility3(in *jlexer.Lexer, out *Property) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "name": - (out.Name).UnmarshalEasyJSON(in) - case "value": - if in.IsNull() { - in.Skip() - out.Value = nil - } else { - if out.Value == nil { - out.Value = new(Value) - } - (*out.Value).UnmarshalEasyJSON(in) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility3(out *jwriter.Writer, in Property) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (in.Name).MarshalEasyJSON(out) - } - { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.Value == nil { - out.RawString("null") - } else { - (*in.Value).MarshalEasyJSON(out) - } - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Property) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility3(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Property) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility3(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Property) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility3(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Property) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility3(l, v) -} -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility4(in *jlexer.Lexer, out *Node) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "nodeId": - out.NodeID = NodeID(in.String()) - case "ignored": - out.Ignored = bool(in.Bool()) - case "ignoredReasons": - if in.IsNull() { - in.Skip() - out.IgnoredReasons = nil - } else { - in.Delim('[') - if out.IgnoredReasons == nil { - if !in.IsDelim(']') { - out.IgnoredReasons = make([]*Property, 0, 8) - } else { - out.IgnoredReasons = []*Property{} - } - } else { - out.IgnoredReasons = (out.IgnoredReasons)[:0] - } - for !in.IsDelim(']') { - var v7 *Property - if in.IsNull() { - in.Skip() - v7 = nil - } else { - if v7 == nil { - v7 = new(Property) - } - (*v7).UnmarshalEasyJSON(in) - } - out.IgnoredReasons = append(out.IgnoredReasons, v7) - in.WantComma() - } - in.Delim(']') - } - case "role": - if in.IsNull() { - in.Skip() - out.Role = nil - } else { - if out.Role == nil { - out.Role = new(Value) - } - (*out.Role).UnmarshalEasyJSON(in) - } - case "name": - if in.IsNull() { - in.Skip() - out.Name = nil - } else { - if out.Name == nil { - out.Name = new(Value) - } - (*out.Name).UnmarshalEasyJSON(in) - } - case "description": - if in.IsNull() { - in.Skip() - out.Description = nil - } else { - if out.Description == nil { - out.Description = new(Value) - } - (*out.Description).UnmarshalEasyJSON(in) - } - case "value": - if in.IsNull() { - in.Skip() - out.Value = nil - } else { - if out.Value == nil { - out.Value = new(Value) - } - (*out.Value).UnmarshalEasyJSON(in) - } - case "properties": - if in.IsNull() { - in.Skip() - out.Properties = nil - } else { - in.Delim('[') - if out.Properties == nil { - if !in.IsDelim(']') { - out.Properties = make([]*Property, 0, 8) - } else { - out.Properties = []*Property{} - } - } else { - out.Properties = (out.Properties)[:0] - } - for !in.IsDelim(']') { - var v8 *Property - if in.IsNull() { - in.Skip() - v8 = nil - } else { - if v8 == nil { - v8 = new(Property) - } - (*v8).UnmarshalEasyJSON(in) - } - out.Properties = append(out.Properties, v8) - in.WantComma() - } - in.Delim(']') - } - case "childIds": - if in.IsNull() { - in.Skip() - out.ChildIds = nil - } else { - in.Delim('[') - if out.ChildIds == nil { - if !in.IsDelim(']') { - out.ChildIds = make([]NodeID, 0, 4) - } else { - out.ChildIds = []NodeID{} - } - } else { - out.ChildIds = (out.ChildIds)[:0] - } - for !in.IsDelim(']') { - var v9 NodeID - v9 = NodeID(in.String()) - out.ChildIds = append(out.ChildIds, v9) - in.WantComma() - } - in.Delim(']') - } - case "backendDOMNodeId": - (out.BackendDOMNodeID).UnmarshalEasyJSON(in) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility4(out *jwriter.Writer, in Node) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"nodeId\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.NodeID)) - } - { - const prefix string = ",\"ignored\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.Ignored)) - } - if len(in.IgnoredReasons) != 0 { - const prefix string = ",\"ignoredReasons\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v10, v11 := range in.IgnoredReasons { - if v10 > 0 { - out.RawByte(',') - } - if v11 == nil { - out.RawString("null") - } else { - (*v11).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - if in.Role != nil { - const prefix string = ",\"role\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Role).MarshalEasyJSON(out) - } - if in.Name != nil { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Name).MarshalEasyJSON(out) - } - if in.Description != nil { - const prefix string = ",\"description\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Description).MarshalEasyJSON(out) - } - if in.Value != nil { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Value).MarshalEasyJSON(out) - } - if len(in.Properties) != 0 { - const prefix string = ",\"properties\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v12, v13 := range in.Properties { - if v12 > 0 { - out.RawByte(',') - } - if v13 == nil { - out.RawString("null") - } else { - (*v13).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - if len(in.ChildIds) != 0 { - const prefix string = ",\"childIds\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v14, v15 := range in.ChildIds { - if v14 > 0 { - out.RawByte(',') - } - out.String(string(v15)) - } - out.RawByte(']') - } - } - if in.BackendDOMNodeID != 0 { - const prefix string = ",\"backendDOMNodeId\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.BackendDOMNodeID)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Node) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility4(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Node) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility4(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Node) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility4(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Node) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility4(l, v) -} -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility5(in *jlexer.Lexer, out *GetPartialAXTreeReturns) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "nodes": - if in.IsNull() { - in.Skip() - out.Nodes = nil - } else { - in.Delim('[') - if out.Nodes == nil { - if !in.IsDelim(']') { - out.Nodes = make([]*Node, 0, 8) - } else { - out.Nodes = []*Node{} - } - } else { - out.Nodes = (out.Nodes)[:0] - } - for !in.IsDelim(']') { - var v16 *Node - if in.IsNull() { - in.Skip() - v16 = nil - } else { - if v16 == nil { - v16 = new(Node) - } - (*v16).UnmarshalEasyJSON(in) - } - out.Nodes = append(out.Nodes, v16) - in.WantComma() - } - in.Delim(']') - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility5(out *jwriter.Writer, in GetPartialAXTreeReturns) { - out.RawByte('{') - first := true - _ = first - if len(in.Nodes) != 0 { - const prefix string = ",\"nodes\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v17, v18 := range in.Nodes { - if v17 > 0 { - out.RawByte(',') - } - if v18 == nil { - out.RawString("null") - } else { - (*v18).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v GetPartialAXTreeReturns) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility5(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v GetPartialAXTreeReturns) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility5(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *GetPartialAXTreeReturns) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility5(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *GetPartialAXTreeReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility5(l, v) -} -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility6(in *jlexer.Lexer, out *GetPartialAXTreeParams) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "nodeId": - (out.NodeID).UnmarshalEasyJSON(in) - case "backendNodeId": - (out.BackendNodeID).UnmarshalEasyJSON(in) - case "objectId": - out.ObjectID = runtime.RemoteObjectID(in.String()) - case "fetchRelatives": - out.FetchRelatives = bool(in.Bool()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility6(out *jwriter.Writer, in GetPartialAXTreeParams) { - out.RawByte('{') - first := true - _ = first - if in.NodeID != 0 { - const prefix string = ",\"nodeId\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.NodeID)) - } - if in.BackendNodeID != 0 { - const prefix string = ",\"backendNodeId\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.BackendNodeID)) - } - if in.ObjectID != "" { - const prefix string = ",\"objectId\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ObjectID)) - } - if in.FetchRelatives { - const prefix string = ",\"fetchRelatives\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.FetchRelatives)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v GetPartialAXTreeParams) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility6(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v GetPartialAXTreeParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility6(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *GetPartialAXTreeParams) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility6(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *GetPartialAXTreeParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility6(l, v) -} diff --git a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/types.go b/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/types.go deleted file mode 100644 index 6170e29..0000000 --- a/e2e/webrtc-chrome/vendor/github.com/chromedp/cdproto/accessibility/types.go +++ /dev/null @@ -1,416 +0,0 @@ -package accessibility - -// Code generated by cdproto-gen. DO NOT EDIT. - -import ( - "errors" - - "github.com/chromedp/cdproto/cdp" - "github.com/mailru/easyjson" - "github.com/mailru/easyjson/jlexer" - "github.com/mailru/easyjson/jwriter" -) - -// NodeID unique accessibility node identifier. -type NodeID string - -// String returns the NodeID as string value. -func (t NodeID) String() string { - return string(t) -} - -// ValueType enum of possible property types. -type ValueType string - -// String returns the ValueType as string value. -func (t ValueType) String() string { - return string(t) -} - -// ValueType values. -const ( - ValueTypeBoolean ValueType = "boolean" - ValueTypeTristate ValueType = "tristate" - ValueTypeBooleanOrUndefined ValueType = "booleanOrUndefined" - ValueTypeIdref ValueType = "idref" - ValueTypeIdrefList ValueType = "idrefList" - ValueTypeInteger ValueType = "integer" - ValueTypeNode ValueType = "node" - ValueTypeNodeList ValueType = "nodeList" - ValueTypeNumber ValueType = "number" - ValueTypeString ValueType = "string" - ValueTypeComputedString ValueType = "computedString" - ValueTypeToken ValueType = "token" - ValueTypeTokenList ValueType = "tokenList" - ValueTypeDomRelation ValueType = "domRelation" - ValueTypeRole ValueType = "role" - ValueTypeInternalRole ValueType = "internalRole" - ValueTypeValueUndefined ValueType = "valueUndefined" -) - -// MarshalEasyJSON satisfies easyjson.Marshaler. -func (t ValueType) MarshalEasyJSON(out *jwriter.Writer) { - out.String(string(t)) -} - -// MarshalJSON satisfies json.Marshaler. -func (t ValueType) MarshalJSON() ([]byte, error) { - return easyjson.Marshal(t) -} - -// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. -func (t *ValueType) UnmarshalEasyJSON(in *jlexer.Lexer) { - switch ValueType(in.String()) { - case ValueTypeBoolean: - *t = ValueTypeBoolean - case ValueTypeTristate: - *t = ValueTypeTristate - case ValueTypeBooleanOrUndefined: - *t = ValueTypeBooleanOrUndefined - case ValueTypeIdref: - *t = ValueTypeIdref - case ValueTypeIdrefList: - *t = ValueTypeIdrefList - case ValueTypeInteger: - *t = ValueTypeInteger - case ValueTypeNode: - *t = ValueTypeNode - case ValueTypeNodeList: - *t = ValueTypeNodeList - case ValueTypeNumber: - *t = ValueTypeNumber - case ValueTypeString: - *t = ValueTypeString - case ValueTypeComputedString: - *t = ValueTypeComputedString - case ValueTypeToken: - *t = ValueTypeToken - case ValueTypeTokenList: - *t = ValueTypeTokenList - case ValueTypeDomRelation: - *t = ValueTypeDomRelation - case ValueTypeRole: - *t = ValueTypeRole - case ValueTypeInternalRole: - *t = ValueTypeInternalRole - case ValueTypeValueUndefined: - *t = ValueTypeValueUndefined - - default: - in.AddError(errors.New("unknown ValueType value")) - } -} - -// UnmarshalJSON satisfies json.Unmarshaler. -func (t *ValueType) UnmarshalJSON(buf []byte) error { - return easyjson.Unmarshal(buf, t) -} - -// ValueSourceType enum of possible property sources. -type ValueSourceType string - -// String returns the ValueSourceType as string value. -func (t ValueSourceType) String() string { - return string(t) -} - -// ValueSourceType values. -const ( - ValueSourceTypeAttribute ValueSourceType = "attribute" - ValueSourceTypeImplicit ValueSourceType = "implicit" - ValueSourceTypeStyle ValueSourceType = "style" - ValueSourceTypeContents ValueSourceType = "contents" - ValueSourceTypePlaceholder ValueSourceType = "placeholder" - ValueSourceTypeRelatedElement ValueSourceType = "relatedElement" -) - -// MarshalEasyJSON satisfies easyjson.Marshaler. -func (t ValueSourceType) MarshalEasyJSON(out *jwriter.Writer) { - out.String(string(t)) -} - -// MarshalJSON satisfies json.Marshaler. -func (t ValueSourceType) MarshalJSON() ([]byte, error) { - return easyjson.Marshal(t) -} - -// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. -func (t *ValueSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) { - switch ValueSourceType(in.String()) { - case ValueSourceTypeAttribute: - *t = ValueSourceTypeAttribute - case ValueSourceTypeImplicit: - *t = ValueSourceTypeImplicit - case ValueSourceTypeStyle: - *t = ValueSourceTypeStyle - case ValueSourceTypeContents: - *t = ValueSourceTypeContents - case ValueSourceTypePlaceholder: - *t = ValueSourceTypePlaceholder - case ValueSourceTypeRelatedElement: - *t = ValueSourceTypeRelatedElement - - default: - in.AddError(errors.New("unknown ValueSourceType value")) - } -} - -// UnmarshalJSON satisfies json.Unmarshaler. -func (t *ValueSourceType) UnmarshalJSON(buf []byte) error { - return easyjson.Unmarshal(buf, t) -} - -// ValueNativeSourceType enum of possible native property sources (as a -// subtype of a particular AXValueSourceType). -type ValueNativeSourceType string - -// String returns the ValueNativeSourceType as string value. -func (t ValueNativeSourceType) String() string { - return string(t) -} - -// ValueNativeSourceType values. -const ( - ValueNativeSourceTypeFigcaption ValueNativeSourceType = "figcaption" - ValueNativeSourceTypeLabel ValueNativeSourceType = "label" - ValueNativeSourceTypeLabelfor ValueNativeSourceType = "labelfor" - ValueNativeSourceTypeLabelwrapped ValueNativeSourceType = "labelwrapped" - ValueNativeSourceTypeLegend ValueNativeSourceType = "legend" - ValueNativeSourceTypeTablecaption ValueNativeSourceType = "tablecaption" - ValueNativeSourceTypeTitle ValueNativeSourceType = "title" - ValueNativeSourceTypeOther ValueNativeSourceType = "other" -) - -// MarshalEasyJSON satisfies easyjson.Marshaler. -func (t ValueNativeSourceType) MarshalEasyJSON(out *jwriter.Writer) { - out.String(string(t)) -} - -// MarshalJSON satisfies json.Marshaler. -func (t ValueNativeSourceType) MarshalJSON() ([]byte, error) { - return easyjson.Marshal(t) -} - -// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. -func (t *ValueNativeSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) { - switch ValueNativeSourceType(in.String()) { - case ValueNativeSourceTypeFigcaption: - *t = ValueNativeSourceTypeFigcaption - case ValueNativeSourceTypeLabel: - *t = ValueNativeSourceTypeLabel - case ValueNativeSourceTypeLabelfor: - *t = ValueNativeSourceTypeLabelfor - case ValueNativeSourceTypeLabelwrapped: - *t = ValueNativeSourceTypeLabelwrapped - case ValueNativeSourceTypeLegend: - *t = ValueNativeSourceTypeLegend - case ValueNativeSourceTypeTablecaption: - *t = ValueNativeSourceTypeTablecaption - case ValueNativeSourceTypeTitle: - *t = ValueNativeSourceTypeTitle - case ValueNativeSourceTypeOther: - *t = ValueNativeSourceTypeOther - - default: - in.AddError(errors.New("unknown ValueNativeSourceType value")) - } -} - -// UnmarshalJSON satisfies json.Unmarshaler. -func (t *ValueNativeSourceType) UnmarshalJSON(buf []byte) error { - return easyjson.Unmarshal(buf, t) -} - -// ValueSource a single source for a computed AX property. -type ValueSource struct { - Type ValueSourceType `json:"type"` // What type of source this is. - Value *Value `json:"value,omitempty"` // The value of this property source. - Attribute string `json:"attribute,omitempty"` // The name of the relevant attribute, if any. - AttributeValue *Value `json:"attributeValue,omitempty"` // The value of the relevant attribute, if any. - Superseded bool `json:"superseded,omitempty"` // Whether this source is superseded by a higher priority source. - NativeSource ValueNativeSourceType `json:"nativeSource,omitempty"` // The native markup source for this value, e.g. a