update complete
This commit is contained in:
1 parent
c145142a42
commit
78146d98f7
56 files changed
+5729
-3815
No files matched your search
@@ -2,8 +2,8 @@ build:
|
|||||||
CGO_ENABLED=1 go build -mod=vendor -tags=embed -ldflags "-s -w" -trimpath -o service main.go
|
CGO_ENABLED=1 go build -mod=vendor -tags=embed -ldflags "-s -w" -trimpath -o service main.go
|
||||||
|
|
||||||
build-static:
|
build-static:
|
||||||
npm --prefix static ci && npm --prefix static run build
|
npm --prefix static ci && npm --prefix static audit fix && npm --prefix static run build
|
||||||
cp -r audio static/dist/audio
|
cp -r audio static/dist/browser/audio
|
||||||
|
|
||||||
build-armhf:
|
build-armhf:
|
||||||
GOARCH=arm \
|
GOARCH=arm \
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ require (
|
|||||||
github.com/hashicorp/mdns v1.0.5
|
github.com/hashicorp/mdns v1.0.5
|
||||||
github.com/holoplot/go-evdev v0.0.0-20240306072622-217e18f17db1
|
github.com/holoplot/go-evdev v0.0.0-20240306072622-217e18f17db1
|
||||||
github.com/pion/rtcp v1.2.14
|
github.com/pion/rtcp v1.2.14
|
||||||
github.com/pion/webrtc/v3 v3.2.40
|
github.com/pion/webrtc/v3 v3.2.42
|
||||||
go.uber.org/zap v1.27.0
|
go.uber.org/zap v1.27.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
nhooyr.io/websocket v1.8.11
|
nhooyr.io/websocket v1.8.11
|
||||||
@@ -30,10 +30,10 @@ require (
|
|||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.21.0 // indirect
|
github.com/go-playground/validator/v10 v10.22.0 // indirect
|
||||||
github.com/goccy/go-json v0.10.3 // indirect
|
github.com/goccy/go-json v0.10.3 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
|
||||||
github.com/kr/pretty v0.3.1 // indirect
|
github.com/kr/pretty v0.3.1 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
@@ -44,7 +44,7 @@ require (
|
|||||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||||
github.com/pion/datachannel v1.5.6 // indirect
|
github.com/pion/datachannel v1.5.6 // indirect
|
||||||
github.com/pion/dtls/v2 v2.2.11 // indirect
|
github.com/pion/dtls/v2 v2.2.11 // indirect
|
||||||
github.com/pion/ice/v2 v2.3.24 // indirect
|
github.com/pion/ice/v2 v2.3.25 // indirect
|
||||||
github.com/pion/interceptor v0.1.29 // indirect
|
github.com/pion/interceptor v0.1.29 // indirect
|
||||||
github.com/pion/logging v0.2.2 // indirect
|
github.com/pion/logging v0.2.2 // indirect
|
||||||
github.com/pion/mdns v0.0.12 // indirect
|
github.com/pion/mdns v0.0.12 // indirect
|
||||||
@@ -69,6 +69,6 @@ require (
|
|||||||
golang.org/x/sys v0.21.0 // indirect
|
golang.org/x/sys v0.21.0 // indirect
|
||||||
golang.org/x/text v0.16.0 // indirect
|
golang.org/x/text v0.16.0 // indirect
|
||||||
golang.org/x/tools v0.22.0 // indirect
|
golang.org/x/tools v0.22.0 // indirect
|
||||||
google.golang.org/protobuf v1.34.1 // indirect
|
google.golang.org/protobuf v1.34.2 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||||
)
|
)
|
||||||
@@ -31,8 +31,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
|||||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.21.0 h1:4fZA11ovvtkdgaeev9RGWPgc1uj3H8W+rNYyH/ySBb0=
|
github.com/go-playground/validator/v10 v10.22.0 h1:k6HsTZ0sTnROkhS//R0O+55JgM8C4Bx7ia+JlgcnOao=
|
||||||
github.com/go-playground/validator/v10 v10.21.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
github.com/go-playground/validator/v10 v10.22.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||||
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
||||||
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
@@ -48,8 +48,8 @@ github.com/holoplot/go-evdev v0.0.0-20240306072622-217e18f17db1/go.mod h1:iHAf8O
|
|||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
@@ -80,8 +80,8 @@ github.com/pion/datachannel v1.5.6/go.mod h1:1eKT6Q85pRnr2mHiWHxJwO50SfZRtWHTsNI
|
|||||||
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
|
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
|
||||||
github.com/pion/dtls/v2 v2.2.11 h1:9U/dpCYl1ySttROPWJgqWKEylUdT0fXp/xst6JwY5Ks=
|
github.com/pion/dtls/v2 v2.2.11 h1:9U/dpCYl1ySttROPWJgqWKEylUdT0fXp/xst6JwY5Ks=
|
||||||
github.com/pion/dtls/v2 v2.2.11/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE=
|
github.com/pion/dtls/v2 v2.2.11/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE=
|
||||||
github.com/pion/ice/v2 v2.3.24 h1:RYgzhH/u5lH0XO+ABatVKCtRd+4U1GEaCXSMjNr13tI=
|
github.com/pion/ice/v2 v2.3.25 h1:M5rJA07dqhi3nobJIg+uPtcVjFECTrhcR3n0ns8kDZs=
|
||||||
github.com/pion/ice/v2 v2.3.24/go.mod h1:KXJJcZK7E8WzrBEYnV4UtqEZsGeWfHxsNqhVcVvgjxw=
|
github.com/pion/ice/v2 v2.3.25/go.mod h1:KXJJcZK7E8WzrBEYnV4UtqEZsGeWfHxsNqhVcVvgjxw=
|
||||||
github.com/pion/interceptor v0.1.29 h1:39fsnlP1U8gw2JzOFWdfCU82vHvhW9o0rZnZF56wF+M=
|
github.com/pion/interceptor v0.1.29 h1:39fsnlP1U8gw2JzOFWdfCU82vHvhW9o0rZnZF56wF+M=
|
||||||
github.com/pion/interceptor v0.1.29/go.mod h1:ri+LGNjRUc5xUNtDEPzfdkmSqISixVTBF/z/Zms/6T4=
|
github.com/pion/interceptor v0.1.29/go.mod h1:ri+LGNjRUc5xUNtDEPzfdkmSqISixVTBF/z/Zms/6T4=
|
||||||
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
|
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
|
||||||
@@ -117,8 +117,8 @@ github.com/pion/transport/v3 v3.0.2/go.mod h1:nIToODoOlb5If2jF9y2Igfx3PFYWfuXi37
|
|||||||
github.com/pion/turn/v2 v2.1.3/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
|
github.com/pion/turn/v2 v2.1.3/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
|
||||||
github.com/pion/turn/v2 v2.1.6 h1:Xr2niVsiPTB0FPtt+yAWKFUkU1eotQbGgpTIld4x1Gc=
|
github.com/pion/turn/v2 v2.1.6 h1:Xr2niVsiPTB0FPtt+yAWKFUkU1eotQbGgpTIld4x1Gc=
|
||||||
github.com/pion/turn/v2 v2.1.6/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
|
github.com/pion/turn/v2 v2.1.6/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
|
||||||
github.com/pion/webrtc/v3 v3.2.40 h1:Wtfi6AZMQg+624cvCXUuSmrKWepSB7zfgYDOYqsSOVU=
|
github.com/pion/webrtc/v3 v3.2.42 h1:WN/ZuMjtpQOoGRCZUg/zFG+JHEvYLVyDKOxU6H1qWlE=
|
||||||
github.com/pion/webrtc/v3 v3.2.40/go.mod h1:M1RAe3TNTD1tzyvqHrbVODfwdPGSXOUo/OgpoGGJqFY=
|
github.com/pion/webrtc/v3 v3.2.42/go.mod h1:M1RAe3TNTD1tzyvqHrbVODfwdPGSXOUo/OgpoGGJqFY=
|
||||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||||
@@ -234,8 +234,8 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
|||||||
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
|
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
|
||||||
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
|
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
|||||||
@@ -59,7 +59,10 @@ func NewWebrtcHandler(ctx context.Context, lg *zap.Logger, cfg *common.ConfigStr
|
|||||||
wh.lg.Info("new connection", zap.String("id", sh.Id))
|
wh.lg.Info("new connection", zap.String("id", sh.Id))
|
||||||
|
|
||||||
// create new peer handle
|
// create new peer handle
|
||||||
wh.createPeerHandle(ctx, sh)
|
if err := wh.createPeerHandle(ctx, sh); err != nil {
|
||||||
|
lg.Error("failed to create peer handle", zap.Error(err))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// make sure the pipelines are running
|
// make sure the pipelines are running
|
||||||
wh.startPipelines()
|
wh.startPipelines()
|
||||||
|
|||||||
+32
-39
@@ -15,53 +15,48 @@
|
|||||||
"prefix": "app",
|
"prefix": "app",
|
||||||
"architect": {
|
"architect": {
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
"builder": "@angular-devkit/build-angular:application",
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist",
|
"outputPath": "dist",
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"main": "src/main.ts",
|
"browser": "src/main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": [
|
||||||
|
"zone.js"
|
||||||
|
],
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon.ico",
|
{
|
||||||
"src/assets",
|
"glob": "**/*",
|
||||||
"src/manifest.webmanifest"
|
"input": "public"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"styles": ["src/styles.scss"],
|
"styles": [
|
||||||
"scripts": [],
|
"src/styles.scss"
|
||||||
"serviceWorker": true,
|
],
|
||||||
"ngswConfigPath": "ngsw-config.json"
|
"scripts": []
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "initial",
|
"type": "initial",
|
||||||
"maximumWarning": "500kb",
|
"maximumWarning": "500kB",
|
||||||
"maximumError": "1mb"
|
"maximumError": "1MB"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "2kb",
|
"maximumWarning": "2kB",
|
||||||
"maximumError": "4kb"
|
"maximumError": "4kB"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileReplacements": [
|
"outputHashing": "all",
|
||||||
{
|
"serviceWorker": "ngsw-config.json"
|
||||||
"replace": "src/environments/environment.ts",
|
|
||||||
"with": "src/environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputHashing": "all"
|
|
||||||
},
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"buildOptimizer": false,
|
|
||||||
"optimization": false,
|
"optimization": false,
|
||||||
"vendorChunk": true,
|
|
||||||
"extractLicenses": false,
|
"extractLicenses": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true
|
||||||
"namedChunks": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "production"
|
"defaultConfiguration": "production"
|
||||||
@@ -79,32 +74,30 @@
|
|||||||
"defaultConfiguration": "development"
|
"defaultConfiguration": "development"
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n": {
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
"builder": "@angular-devkit/build-angular:extract-i18n"
|
||||||
"options": {
|
|
||||||
"buildTarget": "webrtc:build"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"builder": "@angular-devkit/build-angular:karma",
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "src/test.ts",
|
"polyfills": [
|
||||||
"polyfills": "src/polyfills.ts",
|
"zone.js",
|
||||||
|
"zone.js/testing"
|
||||||
|
],
|
||||||
"tsConfig": "tsconfig.spec.json",
|
"tsConfig": "tsconfig.spec.json",
|
||||||
"karmaConfig": "karma.conf.js",
|
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon.ico",
|
{
|
||||||
"src/assets",
|
"glob": "**/*",
|
||||||
"src/manifest.webmanifest"
|
"input": "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"styles": ["src/styles.scss"],
|
|
||||||
"scripts": []
|
"scripts": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"cli": {
|
|
||||||
"analytics": "ef0076dd-aa83-4841-9cf2-44ff71ec36f6"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 948 B |
Vendored
-16
@@ -1,16 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en" data-critters-container>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Webrtc</title>
|
|
||||||
<base href="/">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
||||||
<link rel="manifest" href="manifest.webmanifest">
|
|
||||||
<meta name="theme-color" content="#1976d2">
|
|
||||||
<style>html,body{width:100%;height:100%;margin:0}body{background-color:#000}</style><link rel="stylesheet" href="styles.adb4a414eec143fc.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.adb4a414eec143fc.css"></noscript></head>
|
|
||||||
<body>
|
|
||||||
<app-root></app-root>
|
|
||||||
<noscript>Please enable JavaScript to continue using this application.</noscript>
|
|
||||||
<script src="runtime.463294279b1fe43a.js" type="module"></script><script src="polyfills.8049dbc24d3cd374.js" type="module"></script><script src="main.91e89151ffc25325.js" type="module"></script></body>
|
|
||||||
</html>
|
|
||||||
+2
-2
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/kaedwen/webrtc/pkg/common"
|
"github.com/kaedwen/webrtc/pkg/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed dist/*
|
//go:embed dist/browser/*
|
||||||
var f embed.FS
|
var f embed.FS
|
||||||
|
|
||||||
type staticSourceFile struct {
|
type staticSourceFile struct {
|
||||||
@@ -42,7 +42,7 @@ func (s staticSource) Open(p string) (common.StaticSourceFile, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SetupHandler(e *gin.Engine, cfg *common.Config) {
|
func SetupHandler(e *gin.Engine, cfg *common.Config) {
|
||||||
handler := common.NewStaticHandler(staticSource{"dist"}, "index.html")
|
handler := common.NewStaticHandler(staticSource{"dist/browser"}, "index.html")
|
||||||
e.NoRoute(func(c *gin.Context) {
|
e.NoRoute(func(c *gin.Context) {
|
||||||
encoding := c.Request.Header.Get("Accept-Encoding")
|
encoding := c.Request.Header.Get("Accept-Encoding")
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
"updateMode": "prefetch",
|
"updateMode": "prefetch",
|
||||||
"resources": {
|
"resources": {
|
||||||
"files": [
|
"files": [
|
||||||
"/assets/**",
|
"/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
|
||||||
"/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+4968
-3211
File diff suppressed because it is too large.
Load diff
+13
-13
@@ -10,24 +10,24 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^17.3.2",
|
"@angular/animations": "^18.0.2",
|
||||||
"@angular/common": "^17.3.2",
|
"@angular/common": "^18.0.2",
|
||||||
"@angular/compiler": "^17.3.2",
|
"@angular/compiler": "^18.0.2",
|
||||||
"@angular/core": "^17.3.2",
|
"@angular/core": "^18.0.2",
|
||||||
"@angular/forms": "^17.3.2",
|
"@angular/forms": "^18.0.2",
|
||||||
"@angular/platform-browser": "^17.3.2",
|
"@angular/platform-browser": "^18.0.2",
|
||||||
"@angular/platform-browser-dynamic": "^17.3.2",
|
"@angular/platform-browser-dynamic": "^18.0.2",
|
||||||
"@angular/router": "^17.3.2",
|
"@angular/router": "^18.0.2",
|
||||||
"@angular/service-worker": "^17.3.2",
|
"@angular/service-worker": "^18.0.2",
|
||||||
"rxjs": "~7.5.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"zone.js": "~0.14.4"
|
"zone.js": "~0.14.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^17.3.2",
|
"@angular-devkit/build-angular": "^18.0.3",
|
||||||
"@angular/cli": "~17.3.2",
|
"@angular/cli": "~18.0.3",
|
||||||
"@angular/compiler-cli": "^17.3.2",
|
"@angular/compiler-cli": "^18.0.2",
|
||||||
"@types/jasmine": "~4.0.0",
|
"@types/jasmine": "~4.0.0",
|
||||||
"@types/uuid": "^9.0.1",
|
"@types/uuid": "^9.0.1",
|
||||||
"jasmine-core": "~4.3.0",
|
"jasmine-core": "~4.3.0",
|
||||||
@@ -36,6 +36,6 @@
|
|||||||
"karma-coverage": "~2.2.0",
|
"karma-coverage": "~2.2.0",
|
||||||
"karma-jasmine": "~5.1.0",
|
"karma-jasmine": "~5.1.0",
|
||||||
"karma-jasmine-html-reporter": "~2.0.0",
|
"karma-jasmine-html-reporter": "~2.0.0",
|
||||||
"typescript": "~5.3.3"
|
"typescript": "~5.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "webrtc",
|
"name": "angular-pwa",
|
||||||
"short_name": "webrtc",
|
"short_name": "angular-pwa",
|
||||||
"theme_color": "#1976d2",
|
"theme_color": "#1976d2",
|
||||||
"background_color": "#fafafa",
|
"background_color": "#fafafa",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
@@ -8,49 +8,49 @@
|
|||||||
"start_url": "./",
|
"start_url": "./",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-72x72.png",
|
"src": "icons/icon-72x72.png",
|
||||||
"sizes": "72x72",
|
"sizes": "72x72",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-96x96.png",
|
"src": "icons/icon-96x96.png",
|
||||||
"sizes": "96x96",
|
"sizes": "96x96",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-128x128.png",
|
"src": "icons/icon-128x128.png",
|
||||||
"sizes": "128x128",
|
"sizes": "128x128",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-144x144.png",
|
"src": "icons/icon-144x144.png",
|
||||||
"sizes": "144x144",
|
"sizes": "144x144",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-152x152.png",
|
"src": "icons/icon-152x152.png",
|
||||||
"sizes": "152x152",
|
"sizes": "152x152",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-192x192.png",
|
"src": "icons/icon-192x192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-384x384.png",
|
"src": "icons/icon-384x384.png",
|
||||||
"sizes": "384x384",
|
"sizes": "384x384",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-512x512.png",
|
"src": "icons/icon-512x512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable any"
|
"purpose": "maskable any"
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { ApplicationConfig, provideZoneChangeDetection, isDevMode } from '@angular/core';
|
||||||
|
import { provideRouter } from '@angular/router';
|
||||||
|
|
||||||
|
import { routes } from './app.routes';
|
||||||
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
|
|
||||||
|
export const appConfig: ApplicationConfig = {
|
||||||
|
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideServiceWorker('ngsw-worker.js', {
|
||||||
|
enabled: !isDevMode(),
|
||||||
|
registrationStrategy: 'registerWhenStable:30000'
|
||||||
|
})]
|
||||||
|
};
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { NgModule, isDevMode } from '@angular/core';
|
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
import { SignalingService } from './services/signaling.service';
|
|
||||||
import { VideoComponent } from './components/video/video.component';
|
|
||||||
import { AudioComponent } from './components/audio/audio.component';
|
|
||||||
import { ServiceWorkerModule } from '@angular/service-worker';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
AppComponent,
|
|
||||||
VideoComponent,
|
|
||||||
AudioComponent
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
BrowserModule,
|
|
||||||
HttpClientModule,
|
|
||||||
ServiceWorkerModule.register('ngsw-worker.js', {
|
|
||||||
enabled: !isDevMode(),
|
|
||||||
// Register the ServiceWorker as soon as the application is stable
|
|
||||||
// or after 30 seconds (whichever comes first).
|
|
||||||
registrationStrategy: 'registerWhenStable:30000'
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
providers: [SignalingService],
|
|
||||||
bootstrap: [AppComponent]
|
|
||||||
})
|
|
||||||
export class AppModule { }
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
|
export const routes: Routes = [];
|
||||||
Whitespace-only changes.
+5
-11
@@ -1,12 +1,6 @@
|
|||||||
import { enableProdMode } from '@angular/core';
|
import { bootstrapApplication } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { appConfig } from './app/app.config';
|
||||||
|
import { AppComponent } from './app/app.component';
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
bootstrapApplication(AppComponent, appConfig)
|
||||||
import { environment } from './environments/environment';
|
.catch((err) => console.error(err));
|
||||||
|
|
||||||
if (environment.production) {
|
|
||||||
enableProdMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
|
||||||
.catch(err => console.error(err));
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
@@ -12,7 +13,6 @@
|
|||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"downlevelIteration": true,
|
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
Package validator
|
Package validator
|
||||||
=================
|
=================
|
||||||
<img align="right" src="logo.png">[](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
<img align="right" src="logo.png">[](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||

|

|
||||||
[](https://travis-ci.org/go-playground/validator)
|
[](https://travis-ci.org/go-playground/validator)
|
||||||
[](https://coveralls.io/github/go-playground/validator?branch=master)
|
[](https://coveralls.io/github/go-playground/validator?branch=master)
|
||||||
[](https://goreportcard.com/report/github.com/go-playground/validator)
|
[](https://goreportcard.com/report/github.com/go-playground/validator)
|
||||||
|
|||||||
+63
-62
@@ -253,7 +253,7 @@ func parseOneOfParam2(s string) []string {
|
|||||||
oneofValsCacheRWLock.RUnlock()
|
oneofValsCacheRWLock.RUnlock()
|
||||||
if !ok {
|
if !ok {
|
||||||
oneofValsCacheRWLock.Lock()
|
oneofValsCacheRWLock.Lock()
|
||||||
vals = splitParamsRegex.FindAllString(s, -1)
|
vals = splitParamsRegex().FindAllString(s, -1)
|
||||||
for i := 0; i < len(vals); i++ {
|
for i := 0; i < len(vals); i++ {
|
||||||
vals[i] = strings.Replace(vals[i], "'", "", -1)
|
vals[i] = strings.Replace(vals[i], "'", "", -1)
|
||||||
}
|
}
|
||||||
@@ -264,15 +264,15 @@ func parseOneOfParam2(s string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isURLEncoded(fl FieldLevel) bool {
|
func isURLEncoded(fl FieldLevel) bool {
|
||||||
return uRLEncodedRegex.MatchString(fl.Field().String())
|
return uRLEncodedRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func isHTMLEncoded(fl FieldLevel) bool {
|
func isHTMLEncoded(fl FieldLevel) bool {
|
||||||
return hTMLEncodedRegex.MatchString(fl.Field().String())
|
return hTMLEncodedRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func isHTML(fl FieldLevel) bool {
|
func isHTML(fl FieldLevel) bool {
|
||||||
return hTMLRegex.MatchString(fl.Field().String())
|
return hTMLRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func isOneOf(fl FieldLevel) bool {
|
func isOneOf(fl FieldLevel) bool {
|
||||||
@@ -429,7 +429,7 @@ func isSSN(fl FieldLevel) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return sSNRegex.MatchString(field.String())
|
return sSNRegex().MatchString(field.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isLongitude is the validation function for validating if the field's value is a valid longitude coordinate.
|
// isLongitude is the validation function for validating if the field's value is a valid longitude coordinate.
|
||||||
@@ -452,7 +452,7 @@ func isLongitude(fl FieldLevel) bool {
|
|||||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||||
}
|
}
|
||||||
|
|
||||||
return longitudeRegex.MatchString(v)
|
return longitudeRegex().MatchString(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isLatitude is the validation function for validating if the field's value is a valid latitude coordinate.
|
// isLatitude is the validation function for validating if the field's value is a valid latitude coordinate.
|
||||||
@@ -475,7 +475,7 @@ func isLatitude(fl FieldLevel) bool {
|
|||||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||||
}
|
}
|
||||||
|
|
||||||
return latitudeRegex.MatchString(v)
|
return latitudeRegex().MatchString(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isDataURI is the validation function for validating if the field's value is a valid data URI.
|
// isDataURI is the validation function for validating if the field's value is a valid data URI.
|
||||||
@@ -486,11 +486,11 @@ func isDataURI(fl FieldLevel) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if !dataURIRegex.MatchString(uri[0]) {
|
if !dataURIRegex().MatchString(uri[0]) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return base64Regex.MatchString(uri[1])
|
return base64Regex().MatchString(uri[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
// hasMultiByteCharacter is the validation function for validating if the field's value has a multi byte character.
|
// hasMultiByteCharacter is the validation function for validating if the field's value has a multi byte character.
|
||||||
@@ -501,17 +501,17 @@ func hasMultiByteCharacter(fl FieldLevel) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return multibyteRegex.MatchString(field.String())
|
return multibyteRegex().MatchString(field.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isPrintableASCII is the validation function for validating if the field's value is a valid printable ASCII character.
|
// isPrintableASCII is the validation function for validating if the field's value is a valid printable ASCII character.
|
||||||
func isPrintableASCII(fl FieldLevel) bool {
|
func isPrintableASCII(fl FieldLevel) bool {
|
||||||
return printableASCIIRegex.MatchString(fl.Field().String())
|
return printableASCIIRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isASCII is the validation function for validating if the field's value is a valid ASCII character.
|
// isASCII is the validation function for validating if the field's value is a valid ASCII character.
|
||||||
func isASCII(fl FieldLevel) bool {
|
func isASCII(fl FieldLevel) bool {
|
||||||
return aSCIIRegex.MatchString(fl.Field().String())
|
return aSCIIRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isUUID5 is the validation function for validating if the field's value is a valid v5 UUID.
|
// isUUID5 is the validation function for validating if the field's value is a valid v5 UUID.
|
||||||
@@ -561,52 +561,52 @@ func isULID(fl FieldLevel) bool {
|
|||||||
|
|
||||||
// isMD4 is the validation function for validating if the field's value is a valid MD4.
|
// isMD4 is the validation function for validating if the field's value is a valid MD4.
|
||||||
func isMD4(fl FieldLevel) bool {
|
func isMD4(fl FieldLevel) bool {
|
||||||
return md4Regex.MatchString(fl.Field().String())
|
return md4Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isMD5 is the validation function for validating if the field's value is a valid MD5.
|
// isMD5 is the validation function for validating if the field's value is a valid MD5.
|
||||||
func isMD5(fl FieldLevel) bool {
|
func isMD5(fl FieldLevel) bool {
|
||||||
return md5Regex.MatchString(fl.Field().String())
|
return md5Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSHA256 is the validation function for validating if the field's value is a valid SHA256.
|
// isSHA256 is the validation function for validating if the field's value is a valid SHA256.
|
||||||
func isSHA256(fl FieldLevel) bool {
|
func isSHA256(fl FieldLevel) bool {
|
||||||
return sha256Regex.MatchString(fl.Field().String())
|
return sha256Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSHA384 is the validation function for validating if the field's value is a valid SHA384.
|
// isSHA384 is the validation function for validating if the field's value is a valid SHA384.
|
||||||
func isSHA384(fl FieldLevel) bool {
|
func isSHA384(fl FieldLevel) bool {
|
||||||
return sha384Regex.MatchString(fl.Field().String())
|
return sha384Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSHA512 is the validation function for validating if the field's value is a valid SHA512.
|
// isSHA512 is the validation function for validating if the field's value is a valid SHA512.
|
||||||
func isSHA512(fl FieldLevel) bool {
|
func isSHA512(fl FieldLevel) bool {
|
||||||
return sha512Regex.MatchString(fl.Field().String())
|
return sha512Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isRIPEMD128 is the validation function for validating if the field's value is a valid PIPEMD128.
|
// isRIPEMD128 is the validation function for validating if the field's value is a valid PIPEMD128.
|
||||||
func isRIPEMD128(fl FieldLevel) bool {
|
func isRIPEMD128(fl FieldLevel) bool {
|
||||||
return ripemd128Regex.MatchString(fl.Field().String())
|
return ripemd128Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isRIPEMD160 is the validation function for validating if the field's value is a valid PIPEMD160.
|
// isRIPEMD160 is the validation function for validating if the field's value is a valid PIPEMD160.
|
||||||
func isRIPEMD160(fl FieldLevel) bool {
|
func isRIPEMD160(fl FieldLevel) bool {
|
||||||
return ripemd160Regex.MatchString(fl.Field().String())
|
return ripemd160Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isTIGER128 is the validation function for validating if the field's value is a valid TIGER128.
|
// isTIGER128 is the validation function for validating if the field's value is a valid TIGER128.
|
||||||
func isTIGER128(fl FieldLevel) bool {
|
func isTIGER128(fl FieldLevel) bool {
|
||||||
return tiger128Regex.MatchString(fl.Field().String())
|
return tiger128Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isTIGER160 is the validation function for validating if the field's value is a valid TIGER160.
|
// isTIGER160 is the validation function for validating if the field's value is a valid TIGER160.
|
||||||
func isTIGER160(fl FieldLevel) bool {
|
func isTIGER160(fl FieldLevel) bool {
|
||||||
return tiger160Regex.MatchString(fl.Field().String())
|
return tiger160Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isTIGER192 is the validation function for validating if the field's value is a valid isTIGER192.
|
// isTIGER192 is the validation function for validating if the field's value is a valid isTIGER192.
|
||||||
func isTIGER192(fl FieldLevel) bool {
|
func isTIGER192(fl FieldLevel) bool {
|
||||||
return tiger192Regex.MatchString(fl.Field().String())
|
return tiger192Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN.
|
// isISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN.
|
||||||
@@ -618,7 +618,7 @@ func isISBN(fl FieldLevel) bool {
|
|||||||
func isISBN13(fl FieldLevel) bool {
|
func isISBN13(fl FieldLevel) bool {
|
||||||
s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 4), " ", "", 4)
|
s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 4), " ", "", 4)
|
||||||
|
|
||||||
if !iSBN13Regex.MatchString(s) {
|
if !iSBN13Regex().MatchString(s) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ func isISBN13(fl FieldLevel) bool {
|
|||||||
func isISBN10(fl FieldLevel) bool {
|
func isISBN10(fl FieldLevel) bool {
|
||||||
s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 3), " ", "", 3)
|
s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 3), " ", "", 3)
|
||||||
|
|
||||||
if !iSBN10Regex.MatchString(s) {
|
if !iSBN10Regex().MatchString(s) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +662,7 @@ func isISBN10(fl FieldLevel) bool {
|
|||||||
func isISSN(fl FieldLevel) bool {
|
func isISSN(fl FieldLevel) bool {
|
||||||
s := fl.Field().String()
|
s := fl.Field().String()
|
||||||
|
|
||||||
if !iSSNRegex.MatchString(s) {
|
if !iSSNRegex().MatchString(s) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
s = strings.ReplaceAll(s, "-", "")
|
s = strings.ReplaceAll(s, "-", "")
|
||||||
@@ -688,14 +688,14 @@ func isISSN(fl FieldLevel) bool {
|
|||||||
func isEthereumAddress(fl FieldLevel) bool {
|
func isEthereumAddress(fl FieldLevel) bool {
|
||||||
address := fl.Field().String()
|
address := fl.Field().String()
|
||||||
|
|
||||||
return ethAddressRegex.MatchString(address)
|
return ethAddressRegex().MatchString(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isEthereumAddressChecksum is the validation function for validating if the field's value is a valid checksummed Ethereum address.
|
// isEthereumAddressChecksum is the validation function for validating if the field's value is a valid checksummed Ethereum address.
|
||||||
func isEthereumAddressChecksum(fl FieldLevel) bool {
|
func isEthereumAddressChecksum(fl FieldLevel) bool {
|
||||||
address := fl.Field().String()
|
address := fl.Field().String()
|
||||||
|
|
||||||
if !ethAddressRegex.MatchString(address) {
|
if !ethAddressRegex().MatchString(address) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// Checksum validation. Reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
|
// Checksum validation. Reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
|
||||||
@@ -721,7 +721,7 @@ func isEthereumAddressChecksum(fl FieldLevel) bool {
|
|||||||
func isBitcoinAddress(fl FieldLevel) bool {
|
func isBitcoinAddress(fl FieldLevel) bool {
|
||||||
address := fl.Field().String()
|
address := fl.Field().String()
|
||||||
|
|
||||||
if !btcAddressRegex.MatchString(address) {
|
if !btcAddressRegex().MatchString(address) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +758,7 @@ func isBitcoinAddress(fl FieldLevel) bool {
|
|||||||
func isBitcoinBech32Address(fl FieldLevel) bool {
|
func isBitcoinBech32Address(fl FieldLevel) bool {
|
||||||
address := fl.Field().String()
|
address := fl.Field().String()
|
||||||
|
|
||||||
if !btcLowerAddressRegexBech32.MatchString(address) && !btcUpperAddressRegexBech32.MatchString(address) {
|
if !btcLowerAddressRegexBech32().MatchString(address) && !btcUpperAddressRegexBech32().MatchString(address) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1370,6 +1370,7 @@ func isPostcodeByIso3166Alpha2(fl FieldLevel) bool {
|
|||||||
field := fl.Field()
|
field := fl.Field()
|
||||||
param := fl.Param()
|
param := fl.Param()
|
||||||
|
|
||||||
|
postcodeRegexInit.Do(initPostcodes)
|
||||||
reg, found := postCodeRegexDict[param]
|
reg, found := postCodeRegexDict[param]
|
||||||
if !found {
|
if !found {
|
||||||
return false
|
return false
|
||||||
@@ -1407,22 +1408,22 @@ func isPostcodeByIso3166Alpha2Field(fl FieldLevel) bool {
|
|||||||
|
|
||||||
// isBase32 is the validation function for validating if the current field's value is a valid base 32.
|
// isBase32 is the validation function for validating if the current field's value is a valid base 32.
|
||||||
func isBase32(fl FieldLevel) bool {
|
func isBase32(fl FieldLevel) bool {
|
||||||
return base32Regex.MatchString(fl.Field().String())
|
return base32Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isBase64 is the validation function for validating if the current field's value is a valid base 64.
|
// isBase64 is the validation function for validating if the current field's value is a valid base 64.
|
||||||
func isBase64(fl FieldLevel) bool {
|
func isBase64(fl FieldLevel) bool {
|
||||||
return base64Regex.MatchString(fl.Field().String())
|
return base64Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isBase64URL is the validation function for validating if the current field's value is a valid base64 URL safe string.
|
// isBase64URL is the validation function for validating if the current field's value is a valid base64 URL safe string.
|
||||||
func isBase64URL(fl FieldLevel) bool {
|
func isBase64URL(fl FieldLevel) bool {
|
||||||
return base64URLRegex.MatchString(fl.Field().String())
|
return base64URLRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isBase64RawURL is the validation function for validating if the current field's value is a valid base64 URL safe string without '=' padding.
|
// isBase64RawURL is the validation function for validating if the current field's value is a valid base64 URL safe string without '=' padding.
|
||||||
func isBase64RawURL(fl FieldLevel) bool {
|
func isBase64RawURL(fl FieldLevel) bool {
|
||||||
return base64RawURLRegex.MatchString(fl.Field().String())
|
return base64RawURLRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isURI is the validation function for validating if the current field's value is a valid URI.
|
// isURI is the validation function for validating if the current field's value is a valid URI.
|
||||||
@@ -1668,42 +1669,42 @@ func isFilePath(fl FieldLevel) bool {
|
|||||||
|
|
||||||
// isE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number.
|
// isE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number.
|
||||||
func isE164(fl FieldLevel) bool {
|
func isE164(fl FieldLevel) bool {
|
||||||
return e164Regex.MatchString(fl.Field().String())
|
return e164Regex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isEmail is the validation function for validating if the current field's value is a valid email address.
|
// isEmail is the validation function for validating if the current field's value is a valid email address.
|
||||||
func isEmail(fl FieldLevel) bool {
|
func isEmail(fl FieldLevel) bool {
|
||||||
return emailRegex.MatchString(fl.Field().String())
|
return emailRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isHSLA is the validation function for validating if the current field's value is a valid HSLA color.
|
// isHSLA is the validation function for validating if the current field's value is a valid HSLA color.
|
||||||
func isHSLA(fl FieldLevel) bool {
|
func isHSLA(fl FieldLevel) bool {
|
||||||
return hslaRegex.MatchString(fl.Field().String())
|
return hslaRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isHSL is the validation function for validating if the current field's value is a valid HSL color.
|
// isHSL is the validation function for validating if the current field's value is a valid HSL color.
|
||||||
func isHSL(fl FieldLevel) bool {
|
func isHSL(fl FieldLevel) bool {
|
||||||
return hslRegex.MatchString(fl.Field().String())
|
return hslRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isRGBA is the validation function for validating if the current field's value is a valid RGBA color.
|
// isRGBA is the validation function for validating if the current field's value is a valid RGBA color.
|
||||||
func isRGBA(fl FieldLevel) bool {
|
func isRGBA(fl FieldLevel) bool {
|
||||||
return rgbaRegex.MatchString(fl.Field().String())
|
return rgbaRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isRGB is the validation function for validating if the current field's value is a valid RGB color.
|
// isRGB is the validation function for validating if the current field's value is a valid RGB color.
|
||||||
func isRGB(fl FieldLevel) bool {
|
func isRGB(fl FieldLevel) bool {
|
||||||
return rgbRegex.MatchString(fl.Field().String())
|
return rgbRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isHEXColor is the validation function for validating if the current field's value is a valid HEX color.
|
// isHEXColor is the validation function for validating if the current field's value is a valid HEX color.
|
||||||
func isHEXColor(fl FieldLevel) bool {
|
func isHEXColor(fl FieldLevel) bool {
|
||||||
return hexColorRegex.MatchString(fl.Field().String())
|
return hexColorRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isHexadecimal is the validation function for validating if the current field's value is a valid hexadecimal.
|
// isHexadecimal is the validation function for validating if the current field's value is a valid hexadecimal.
|
||||||
func isHexadecimal(fl FieldLevel) bool {
|
func isHexadecimal(fl FieldLevel) bool {
|
||||||
return hexadecimalRegex.MatchString(fl.Field().String())
|
return hexadecimalRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isNumber is the validation function for validating if the current field's value is a valid number.
|
// isNumber is the validation function for validating if the current field's value is a valid number.
|
||||||
@@ -1712,7 +1713,7 @@ func isNumber(fl FieldLevel) bool {
|
|||||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64:
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64:
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return numberRegex.MatchString(fl.Field().String())
|
return numberRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1722,28 +1723,28 @@ func isNumeric(fl FieldLevel) bool {
|
|||||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64:
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64:
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return numericRegex.MatchString(fl.Field().String())
|
return numericRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// isAlphanum is the validation function for validating if the current field's value is a valid alphanumeric value.
|
// isAlphanum is the validation function for validating if the current field's value is a valid alphanumeric value.
|
||||||
func isAlphanum(fl FieldLevel) bool {
|
func isAlphanum(fl FieldLevel) bool {
|
||||||
return alphaNumericRegex.MatchString(fl.Field().String())
|
return alphaNumericRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isAlpha is the validation function for validating if the current field's value is a valid alpha value.
|
// isAlpha is the validation function for validating if the current field's value is a valid alpha value.
|
||||||
func isAlpha(fl FieldLevel) bool {
|
func isAlpha(fl FieldLevel) bool {
|
||||||
return alphaRegex.MatchString(fl.Field().String())
|
return alphaRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isAlphanumUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value.
|
// isAlphanumUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value.
|
||||||
func isAlphanumUnicode(fl FieldLevel) bool {
|
func isAlphanumUnicode(fl FieldLevel) bool {
|
||||||
return alphaUnicodeNumericRegex.MatchString(fl.Field().String())
|
return alphaUnicodeNumericRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isAlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value.
|
// isAlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value.
|
||||||
func isAlphaUnicode(fl FieldLevel) bool {
|
func isAlphaUnicode(fl FieldLevel) bool {
|
||||||
return alphaUnicodeRegex.MatchString(fl.Field().String())
|
return alphaUnicodeRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isBoolean is the validation function for validating if the current field's value is a valid boolean value or can be safely converted to a boolean value.
|
// isBoolean is the validation function for validating if the current field's value is a valid boolean value or can be safely converted to a boolean value.
|
||||||
@@ -2566,11 +2567,11 @@ func isIP6Addr(fl FieldLevel) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isHostnameRFC952(fl FieldLevel) bool {
|
func isHostnameRFC952(fl FieldLevel) bool {
|
||||||
return hostnameRegexRFC952.MatchString(fl.Field().String())
|
return hostnameRegexRFC952().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func isHostnameRFC1123(fl FieldLevel) bool {
|
func isHostnameRFC1123(fl FieldLevel) bool {
|
||||||
return hostnameRegexRFC1123.MatchString(fl.Field().String())
|
return hostnameRegexRFC1123().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func isFQDN(fl FieldLevel) bool {
|
func isFQDN(fl FieldLevel) bool {
|
||||||
@@ -2580,7 +2581,7 @@ func isFQDN(fl FieldLevel) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return fqdnRegexRFC1123.MatchString(val)
|
return fqdnRegexRFC1123().MatchString(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isDir is the validation function for validating if the current field's value is a valid existing directory.
|
// isDir is the validation function for validating if the current field's value is a valid existing directory.
|
||||||
@@ -2679,7 +2680,7 @@ func isJSON(fl FieldLevel) bool {
|
|||||||
|
|
||||||
// isJWT is the validation function for validating if the current field's value is a valid JWT string.
|
// isJWT is the validation function for validating if the current field's value is a valid JWT string.
|
||||||
func isJWT(fl FieldLevel) bool {
|
func isJWT(fl FieldLevel) bool {
|
||||||
return jWTRegex.MatchString(fl.Field().String())
|
return jWTRegex().MatchString(fl.Field().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isHostnamePort validates a <dns>:<port> combination for fields typically used for socket address.
|
// isHostnamePort validates a <dns>:<port> combination for fields typically used for socket address.
|
||||||
@@ -2698,7 +2699,7 @@ func isHostnamePort(fl FieldLevel) bool {
|
|||||||
|
|
||||||
// If host is specified, it should match a DNS name
|
// If host is specified, it should match a DNS name
|
||||||
if host != "" {
|
if host != "" {
|
||||||
return hostnameRegexRFC1123.MatchString(host)
|
return hostnameRegexRFC1123().MatchString(host)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -2885,21 +2886,21 @@ func isBCP47LanguageTag(fl FieldLevel) bool {
|
|||||||
func isIsoBicFormat(fl FieldLevel) bool {
|
func isIsoBicFormat(fl FieldLevel) bool {
|
||||||
bicString := fl.Field().String()
|
bicString := fl.Field().String()
|
||||||
|
|
||||||
return bicRegex.MatchString(bicString)
|
return bicRegex().MatchString(bicString)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSemverFormat is the validation function for validating if the current field's value is a valid semver version, defined in Semantic Versioning 2.0.0
|
// isSemverFormat is the validation function for validating if the current field's value is a valid semver version, defined in Semantic Versioning 2.0.0
|
||||||
func isSemverFormat(fl FieldLevel) bool {
|
func isSemverFormat(fl FieldLevel) bool {
|
||||||
semverString := fl.Field().String()
|
semverString := fl.Field().String()
|
||||||
|
|
||||||
return semverRegex.MatchString(semverString)
|
return semverRegex().MatchString(semverString)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isCveFormat is the validation function for validating if the current field's value is a valid cve id, defined in CVE mitre org
|
// isCveFormat is the validation function for validating if the current field's value is a valid cve id, defined in CVE mitre org
|
||||||
func isCveFormat(fl FieldLevel) bool {
|
func isCveFormat(fl FieldLevel) bool {
|
||||||
cveString := fl.Field().String()
|
cveString := fl.Field().String()
|
||||||
|
|
||||||
return cveRegex.MatchString(cveString)
|
return cveRegex().MatchString(cveString)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isDnsRFC1035LabelFormat is the validation function
|
// isDnsRFC1035LabelFormat is the validation function
|
||||||
@@ -2907,7 +2908,7 @@ func isCveFormat(fl FieldLevel) bool {
|
|||||||
// a valid dns RFC 1035 label, defined in RFC 1035.
|
// a valid dns RFC 1035 label, defined in RFC 1035.
|
||||||
func isDnsRFC1035LabelFormat(fl FieldLevel) bool {
|
func isDnsRFC1035LabelFormat(fl FieldLevel) bool {
|
||||||
val := fl.Field().String()
|
val := fl.Field().String()
|
||||||
return dnsRegexRFC1035Label.MatchString(val)
|
return dnsRegexRFC1035Label().MatchString(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
// digitsHaveLuhnChecksum returns true if and only if the last element of the given digits slice is the Luhn checksum of the previous elements
|
// digitsHaveLuhnChecksum returns true if and only if the last element of the given digits slice is the Luhn checksum of the previous elements
|
||||||
@@ -2936,13 +2937,13 @@ func digitsHaveLuhnChecksum(digits []string) bool {
|
|||||||
// isMongoDBObjectId is the validation function for validating if the current field's value is valid MongoDB ObjectID
|
// isMongoDBObjectId is the validation function for validating if the current field's value is valid MongoDB ObjectID
|
||||||
func isMongoDBObjectId(fl FieldLevel) bool {
|
func isMongoDBObjectId(fl FieldLevel) bool {
|
||||||
val := fl.Field().String()
|
val := fl.Field().String()
|
||||||
return mongodbIdRegex.MatchString(val)
|
return mongodbIdRegex().MatchString(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isMongoDBConnectionString is the validation function for validating if the current field's value is valid MongoDB Connection String
|
// isMongoDBConnectionString is the validation function for validating if the current field's value is valid MongoDB Connection String
|
||||||
func isMongoDBConnectionString(fl FieldLevel) bool {
|
func isMongoDBConnectionString(fl FieldLevel) bool {
|
||||||
val := fl.Field().String()
|
val := fl.Field().String()
|
||||||
return mongodbConnectionRegex.MatchString(val)
|
return mongodbConnectionRegex().MatchString(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSpiceDB is the validation function for validating if the current field's value is valid for use with Authzed SpiceDB in the indicated way
|
// isSpiceDB is the validation function for validating if the current field's value is valid for use with Authzed SpiceDB in the indicated way
|
||||||
@@ -2952,11 +2953,11 @@ func isSpiceDB(fl FieldLevel) bool {
|
|||||||
|
|
||||||
switch param {
|
switch param {
|
||||||
case "permission":
|
case "permission":
|
||||||
return spicedbPermissionRegex.MatchString(val)
|
return spicedbPermissionRegex().MatchString(val)
|
||||||
case "type":
|
case "type":
|
||||||
return spicedbTypeRegex.MatchString(val)
|
return spicedbTypeRegex().MatchString(val)
|
||||||
case "id", "":
|
case "id", "":
|
||||||
return spicedbIDRegex.MatchString(val)
|
return spicedbIDRegex().MatchString(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
panic("Unrecognized parameter: " + param)
|
panic("Unrecognized parameter: " + param)
|
||||||
@@ -3008,5 +3009,5 @@ func hasLuhnChecksum(fl FieldLevel) bool {
|
|||||||
// isCron is the validation function for validating if the current field's value is a valid cron expression
|
// isCron is the validation function for validating if the current field's value is a valid cron expression
|
||||||
func isCron(fl FieldLevel) bool {
|
func isCron(fl FieldLevel) bool {
|
||||||
cronString := fl.Field().String()
|
cronString := fl.Field().String()
|
||||||
return cronRegex.MatchString(cronString)
|
return cronRegex().MatchString(cronString)
|
||||||
}
|
}
|
||||||
+9
-3
@@ -1,6 +1,9 @@
|
|||||||
package validator
|
package validator
|
||||||
|
|
||||||
import "regexp"
|
import (
|
||||||
|
"regexp"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
var postCodePatternDict = map[string]string{
|
var postCodePatternDict = map[string]string{
|
||||||
"GB": `^GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\d{1,4}$`,
|
"GB": `^GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\d{1,4}$`,
|
||||||
@@ -164,9 +167,12 @@ var postCodePatternDict = map[string]string{
|
|||||||
"YT": `^976\d{2}$`,
|
"YT": `^976\d{2}$`,
|
||||||
}
|
}
|
||||||
|
|
||||||
var postCodeRegexDict = map[string]*regexp.Regexp{}
|
var (
|
||||||
|
postcodeRegexInit sync.Once
|
||||||
|
postCodeRegexDict = map[string]*regexp.Regexp{}
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func initPostcodes() {
|
||||||
for countryCode, pattern := range postCodePatternDict {
|
for countryCode, pattern := range postCodePatternDict {
|
||||||
postCodeRegexDict[countryCode] = regexp.MustCompile(pattern)
|
postCodeRegexDict[countryCode] = regexp.MustCompile(pattern)
|
||||||
}
|
}
|
||||||
|
|||||||
+84
-70
@@ -1,6 +1,9 @@
|
|||||||
package validator
|
package validator
|
||||||
|
|
||||||
import "regexp"
|
import (
|
||||||
|
"regexp"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
alphaRegexString = "^[a-zA-Z]+$"
|
alphaRegexString = "^[a-zA-Z]+$"
|
||||||
@@ -76,74 +79,85 @@ const (
|
|||||||
spicedbTypeRegexString = "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$"
|
spicedbTypeRegexString = "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func lazyRegexCompile(str string) func() *regexp.Regexp {
|
||||||
|
var regex *regexp.Regexp
|
||||||
|
var once sync.Once
|
||||||
|
return func() *regexp.Regexp {
|
||||||
|
once.Do(func() {
|
||||||
|
regex = regexp.MustCompile(str)
|
||||||
|
})
|
||||||
|
return regex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
alphaRegex = regexp.MustCompile(alphaRegexString)
|
alphaRegex = lazyRegexCompile(alphaRegexString)
|
||||||
alphaNumericRegex = regexp.MustCompile(alphaNumericRegexString)
|
alphaNumericRegex = lazyRegexCompile(alphaNumericRegexString)
|
||||||
alphaUnicodeRegex = regexp.MustCompile(alphaUnicodeRegexString)
|
alphaUnicodeRegex = lazyRegexCompile(alphaUnicodeRegexString)
|
||||||
alphaUnicodeNumericRegex = regexp.MustCompile(alphaUnicodeNumericRegexString)
|
alphaUnicodeNumericRegex = lazyRegexCompile(alphaUnicodeNumericRegexString)
|
||||||
numericRegex = regexp.MustCompile(numericRegexString)
|
numericRegex = lazyRegexCompile(numericRegexString)
|
||||||
numberRegex = regexp.MustCompile(numberRegexString)
|
numberRegex = lazyRegexCompile(numberRegexString)
|
||||||
hexadecimalRegex = regexp.MustCompile(hexadecimalRegexString)
|
hexadecimalRegex = lazyRegexCompile(hexadecimalRegexString)
|
||||||
hexColorRegex = regexp.MustCompile(hexColorRegexString)
|
hexColorRegex = lazyRegexCompile(hexColorRegexString)
|
||||||
rgbRegex = regexp.MustCompile(rgbRegexString)
|
rgbRegex = lazyRegexCompile(rgbRegexString)
|
||||||
rgbaRegex = regexp.MustCompile(rgbaRegexString)
|
rgbaRegex = lazyRegexCompile(rgbaRegexString)
|
||||||
hslRegex = regexp.MustCompile(hslRegexString)
|
hslRegex = lazyRegexCompile(hslRegexString)
|
||||||
hslaRegex = regexp.MustCompile(hslaRegexString)
|
hslaRegex = lazyRegexCompile(hslaRegexString)
|
||||||
e164Regex = regexp.MustCompile(e164RegexString)
|
e164Regex = lazyRegexCompile(e164RegexString)
|
||||||
emailRegex = regexp.MustCompile(emailRegexString)
|
emailRegex = lazyRegexCompile(emailRegexString)
|
||||||
base32Regex = regexp.MustCompile(base32RegexString)
|
base32Regex = lazyRegexCompile(base32RegexString)
|
||||||
base64Regex = regexp.MustCompile(base64RegexString)
|
base64Regex = lazyRegexCompile(base64RegexString)
|
||||||
base64URLRegex = regexp.MustCompile(base64URLRegexString)
|
base64URLRegex = lazyRegexCompile(base64URLRegexString)
|
||||||
base64RawURLRegex = regexp.MustCompile(base64RawURLRegexString)
|
base64RawURLRegex = lazyRegexCompile(base64RawURLRegexString)
|
||||||
iSBN10Regex = regexp.MustCompile(iSBN10RegexString)
|
iSBN10Regex = lazyRegexCompile(iSBN10RegexString)
|
||||||
iSBN13Regex = regexp.MustCompile(iSBN13RegexString)
|
iSBN13Regex = lazyRegexCompile(iSBN13RegexString)
|
||||||
iSSNRegex = regexp.MustCompile(iSSNRegexString)
|
iSSNRegex = lazyRegexCompile(iSSNRegexString)
|
||||||
uUID3Regex = regexp.MustCompile(uUID3RegexString)
|
uUID3Regex = lazyRegexCompile(uUID3RegexString)
|
||||||
uUID4Regex = regexp.MustCompile(uUID4RegexString)
|
uUID4Regex = lazyRegexCompile(uUID4RegexString)
|
||||||
uUID5Regex = regexp.MustCompile(uUID5RegexString)
|
uUID5Regex = lazyRegexCompile(uUID5RegexString)
|
||||||
uUIDRegex = regexp.MustCompile(uUIDRegexString)
|
uUIDRegex = lazyRegexCompile(uUIDRegexString)
|
||||||
uUID3RFC4122Regex = regexp.MustCompile(uUID3RFC4122RegexString)
|
uUID3RFC4122Regex = lazyRegexCompile(uUID3RFC4122RegexString)
|
||||||
uUID4RFC4122Regex = regexp.MustCompile(uUID4RFC4122RegexString)
|
uUID4RFC4122Regex = lazyRegexCompile(uUID4RFC4122RegexString)
|
||||||
uUID5RFC4122Regex = regexp.MustCompile(uUID5RFC4122RegexString)
|
uUID5RFC4122Regex = lazyRegexCompile(uUID5RFC4122RegexString)
|
||||||
uUIDRFC4122Regex = regexp.MustCompile(uUIDRFC4122RegexString)
|
uUIDRFC4122Regex = lazyRegexCompile(uUIDRFC4122RegexString)
|
||||||
uLIDRegex = regexp.MustCompile(uLIDRegexString)
|
uLIDRegex = lazyRegexCompile(uLIDRegexString)
|
||||||
md4Regex = regexp.MustCompile(md4RegexString)
|
md4Regex = lazyRegexCompile(md4RegexString)
|
||||||
md5Regex = regexp.MustCompile(md5RegexString)
|
md5Regex = lazyRegexCompile(md5RegexString)
|
||||||
sha256Regex = regexp.MustCompile(sha256RegexString)
|
sha256Regex = lazyRegexCompile(sha256RegexString)
|
||||||
sha384Regex = regexp.MustCompile(sha384RegexString)
|
sha384Regex = lazyRegexCompile(sha384RegexString)
|
||||||
sha512Regex = regexp.MustCompile(sha512RegexString)
|
sha512Regex = lazyRegexCompile(sha512RegexString)
|
||||||
ripemd128Regex = regexp.MustCompile(ripemd128RegexString)
|
ripemd128Regex = lazyRegexCompile(ripemd128RegexString)
|
||||||
ripemd160Regex = regexp.MustCompile(ripemd160RegexString)
|
ripemd160Regex = lazyRegexCompile(ripemd160RegexString)
|
||||||
tiger128Regex = regexp.MustCompile(tiger128RegexString)
|
tiger128Regex = lazyRegexCompile(tiger128RegexString)
|
||||||
tiger160Regex = regexp.MustCompile(tiger160RegexString)
|
tiger160Regex = lazyRegexCompile(tiger160RegexString)
|
||||||
tiger192Regex = regexp.MustCompile(tiger192RegexString)
|
tiger192Regex = lazyRegexCompile(tiger192RegexString)
|
||||||
aSCIIRegex = regexp.MustCompile(aSCIIRegexString)
|
aSCIIRegex = lazyRegexCompile(aSCIIRegexString)
|
||||||
printableASCIIRegex = regexp.MustCompile(printableASCIIRegexString)
|
printableASCIIRegex = lazyRegexCompile(printableASCIIRegexString)
|
||||||
multibyteRegex = regexp.MustCompile(multibyteRegexString)
|
multibyteRegex = lazyRegexCompile(multibyteRegexString)
|
||||||
dataURIRegex = regexp.MustCompile(dataURIRegexString)
|
dataURIRegex = lazyRegexCompile(dataURIRegexString)
|
||||||
latitudeRegex = regexp.MustCompile(latitudeRegexString)
|
latitudeRegex = lazyRegexCompile(latitudeRegexString)
|
||||||
longitudeRegex = regexp.MustCompile(longitudeRegexString)
|
longitudeRegex = lazyRegexCompile(longitudeRegexString)
|
||||||
sSNRegex = regexp.MustCompile(sSNRegexString)
|
sSNRegex = lazyRegexCompile(sSNRegexString)
|
||||||
hostnameRegexRFC952 = regexp.MustCompile(hostnameRegexStringRFC952)
|
hostnameRegexRFC952 = lazyRegexCompile(hostnameRegexStringRFC952)
|
||||||
hostnameRegexRFC1123 = regexp.MustCompile(hostnameRegexStringRFC1123)
|
hostnameRegexRFC1123 = lazyRegexCompile(hostnameRegexStringRFC1123)
|
||||||
fqdnRegexRFC1123 = regexp.MustCompile(fqdnRegexStringRFC1123)
|
fqdnRegexRFC1123 = lazyRegexCompile(fqdnRegexStringRFC1123)
|
||||||
btcAddressRegex = regexp.MustCompile(btcAddressRegexString)
|
btcAddressRegex = lazyRegexCompile(btcAddressRegexString)
|
||||||
btcUpperAddressRegexBech32 = regexp.MustCompile(btcAddressUpperRegexStringBech32)
|
btcUpperAddressRegexBech32 = lazyRegexCompile(btcAddressUpperRegexStringBech32)
|
||||||
btcLowerAddressRegexBech32 = regexp.MustCompile(btcAddressLowerRegexStringBech32)
|
btcLowerAddressRegexBech32 = lazyRegexCompile(btcAddressLowerRegexStringBech32)
|
||||||
ethAddressRegex = regexp.MustCompile(ethAddressRegexString)
|
ethAddressRegex = lazyRegexCompile(ethAddressRegexString)
|
||||||
uRLEncodedRegex = regexp.MustCompile(uRLEncodedRegexString)
|
uRLEncodedRegex = lazyRegexCompile(uRLEncodedRegexString)
|
||||||
hTMLEncodedRegex = regexp.MustCompile(hTMLEncodedRegexString)
|
hTMLEncodedRegex = lazyRegexCompile(hTMLEncodedRegexString)
|
||||||
hTMLRegex = regexp.MustCompile(hTMLRegexString)
|
hTMLRegex = lazyRegexCompile(hTMLRegexString)
|
||||||
jWTRegex = regexp.MustCompile(jWTRegexString)
|
jWTRegex = lazyRegexCompile(jWTRegexString)
|
||||||
splitParamsRegex = regexp.MustCompile(splitParamsRegexString)
|
splitParamsRegex = lazyRegexCompile(splitParamsRegexString)
|
||||||
bicRegex = regexp.MustCompile(bicRegexString)
|
bicRegex = lazyRegexCompile(bicRegexString)
|
||||||
semverRegex = regexp.MustCompile(semverRegexString)
|
semverRegex = lazyRegexCompile(semverRegexString)
|
||||||
dnsRegexRFC1035Label = regexp.MustCompile(dnsRegexStringRFC1035Label)
|
dnsRegexRFC1035Label = lazyRegexCompile(dnsRegexStringRFC1035Label)
|
||||||
cveRegex = regexp.MustCompile(cveRegexString)
|
cveRegex = lazyRegexCompile(cveRegexString)
|
||||||
mongodbIdRegex = regexp.MustCompile(mongodbIdRegexString)
|
mongodbIdRegex = lazyRegexCompile(mongodbIdRegexString)
|
||||||
mongodbConnectionRegex = regexp.MustCompile(mongodbConnStringRegexString)
|
mongodbConnectionRegex = lazyRegexCompile(mongodbConnStringRegexString)
|
||||||
cronRegex = regexp.MustCompile(cronRegexString)
|
cronRegex = lazyRegexCompile(cronRegexString)
|
||||||
spicedbIDRegex = regexp.MustCompile(spicedbIDRegexString)
|
spicedbIDRegex = lazyRegexCompile(spicedbIDRegexString)
|
||||||
spicedbPermissionRegex = regexp.MustCompile(spicedbPermissionRegexString)
|
spicedbPermissionRegex = lazyRegexCompile(spicedbPermissionRegexString)
|
||||||
spicedbTypeRegex = regexp.MustCompile(spicedbTypeRegexString)
|
spicedbTypeRegex = lazyRegexCompile(spicedbTypeRegexString)
|
||||||
)
|
)
|
||||||
+2
-1
@@ -297,7 +297,8 @@ func panicIf(err error) {
|
|||||||
|
|
||||||
// Checks if field value matches regex. If fl.Field can be cast to Stringer, it uses the Stringer interfaces
|
// Checks if field value matches regex. If fl.Field can be cast to Stringer, it uses the Stringer interfaces
|
||||||
// String() return value. Otherwise, it uses fl.Field's String() value.
|
// String() return value. Otherwise, it uses fl.Field's String() value.
|
||||||
func fieldMatchesRegexByStringerValOrString(regex *regexp.Regexp, fl FieldLevel) bool {
|
func fieldMatchesRegexByStringerValOrString(regexFn func() *regexp.Regexp, fl FieldLevel) bool {
|
||||||
|
regex := regexFn()
|
||||||
switch fl.Field().Kind() {
|
switch fl.Field().Kind() {
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
return regex.MatchString(fl.Field().String())
|
return regex.MatchString(fl.Field().String())
|
||||||
|
|||||||
+1
@@ -310,6 +310,7 @@ Exit Code 1
|
|||||||
| AVXSLOW | Indicates the CPU performs 2 128 bit operations instead of one |
|
| AVXSLOW | Indicates the CPU performs 2 128 bit operations instead of one |
|
||||||
| AVXVNNI | AVX (VEX encoded) VNNI neural network instructions |
|
| AVXVNNI | AVX (VEX encoded) VNNI neural network instructions |
|
||||||
| AVXVNNIINT8 | AVX-VNNI-INT8 instructions |
|
| AVXVNNIINT8 | AVX-VNNI-INT8 instructions |
|
||||||
|
| AVXVNNIINT16 | AVX-VNNI-INT16 instructions |
|
||||||
| BHI_CTRL | Branch History Injection and Intra-mode Branch Target Injection / CVE-2022-0001, CVE-2022-0002 / INTEL-SA-00598 |
|
| BHI_CTRL | Branch History Injection and Intra-mode Branch Target Injection / CVE-2022-0001, CVE-2022-0002 / INTEL-SA-00598 |
|
||||||
| BMI1 | Bit Manipulation Instruction Set 1 |
|
| BMI1 | Bit Manipulation Instruction Set 1 |
|
||||||
| BMI2 | Bit Manipulation Instruction Set 2 |
|
| BMI2 | Bit Manipulation Instruction Set 2 |
|
||||||
|
|||||||
+2
@@ -104,6 +104,7 @@ const (
|
|||||||
AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one
|
AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one
|
||||||
AVXVNNI // AVX (VEX encoded) VNNI neural network instructions
|
AVXVNNI // AVX (VEX encoded) VNNI neural network instructions
|
||||||
AVXVNNIINT8 // AVX-VNNI-INT8 instructions
|
AVXVNNIINT8 // AVX-VNNI-INT8 instructions
|
||||||
|
AVXVNNIINT16 // AVX-VNNI-INT16 instructions
|
||||||
BHI_CTRL // Branch History Injection and Intra-mode Branch Target Injection / CVE-2022-0001, CVE-2022-0002 / INTEL-SA-00598
|
BHI_CTRL // Branch History Injection and Intra-mode Branch Target Injection / CVE-2022-0001, CVE-2022-0002 / INTEL-SA-00598
|
||||||
BMI1 // Bit Manipulation Instruction Set 1
|
BMI1 // Bit Manipulation Instruction Set 1
|
||||||
BMI2 // Bit Manipulation Instruction Set 2
|
BMI2 // Bit Manipulation Instruction Set 2
|
||||||
@@ -1242,6 +1243,7 @@ func support() flagSet {
|
|||||||
// CPUID.(EAX=7, ECX=1).EDX
|
// CPUID.(EAX=7, ECX=1).EDX
|
||||||
fs.setIf(edx1&(1<<4) != 0, AVXVNNIINT8)
|
fs.setIf(edx1&(1<<4) != 0, AVXVNNIINT8)
|
||||||
fs.setIf(edx1&(1<<5) != 0, AVXNECONVERT)
|
fs.setIf(edx1&(1<<5) != 0, AVXNECONVERT)
|
||||||
|
fs.setIf(edx1&(1<<10) != 0, AVXVNNIINT16)
|
||||||
fs.setIf(edx1&(1<<14) != 0, PREFETCHI)
|
fs.setIf(edx1&(1<<14) != 0, PREFETCHI)
|
||||||
fs.setIf(edx1&(1<<19) != 0, AVX10)
|
fs.setIf(edx1&(1<<19) != 0, AVX10)
|
||||||
fs.setIf(edx1&(1<<21) != 0, APX_F)
|
fs.setIf(edx1&(1<<21) != 0, APX_F)
|
||||||
|
|||||||
+185
-184
@@ -44,194 +44,195 @@ func _() {
|
|||||||
_ = x[AVXSLOW-34]
|
_ = x[AVXSLOW-34]
|
||||||
_ = x[AVXVNNI-35]
|
_ = x[AVXVNNI-35]
|
||||||
_ = x[AVXVNNIINT8-36]
|
_ = x[AVXVNNIINT8-36]
|
||||||
_ = x[BHI_CTRL-37]
|
_ = x[AVXVNNIINT16-37]
|
||||||
_ = x[BMI1-38]
|
_ = x[BHI_CTRL-38]
|
||||||
_ = x[BMI2-39]
|
_ = x[BMI1-39]
|
||||||
_ = x[CETIBT-40]
|
_ = x[BMI2-40]
|
||||||
_ = x[CETSS-41]
|
_ = x[CETIBT-41]
|
||||||
_ = x[CLDEMOTE-42]
|
_ = x[CETSS-42]
|
||||||
_ = x[CLMUL-43]
|
_ = x[CLDEMOTE-43]
|
||||||
_ = x[CLZERO-44]
|
_ = x[CLMUL-44]
|
||||||
_ = x[CMOV-45]
|
_ = x[CLZERO-45]
|
||||||
_ = x[CMPCCXADD-46]
|
_ = x[CMOV-46]
|
||||||
_ = x[CMPSB_SCADBS_SHORT-47]
|
_ = x[CMPCCXADD-47]
|
||||||
_ = x[CMPXCHG8-48]
|
_ = x[CMPSB_SCADBS_SHORT-48]
|
||||||
_ = x[CPBOOST-49]
|
_ = x[CMPXCHG8-49]
|
||||||
_ = x[CPPC-50]
|
_ = x[CPBOOST-50]
|
||||||
_ = x[CX16-51]
|
_ = x[CPPC-51]
|
||||||
_ = x[EFER_LMSLE_UNS-52]
|
_ = x[CX16-52]
|
||||||
_ = x[ENQCMD-53]
|
_ = x[EFER_LMSLE_UNS-53]
|
||||||
_ = x[ERMS-54]
|
_ = x[ENQCMD-54]
|
||||||
_ = x[F16C-55]
|
_ = x[ERMS-55]
|
||||||
_ = x[FLUSH_L1D-56]
|
_ = x[F16C-56]
|
||||||
_ = x[FMA3-57]
|
_ = x[FLUSH_L1D-57]
|
||||||
_ = x[FMA4-58]
|
_ = x[FMA3-58]
|
||||||
_ = x[FP128-59]
|
_ = x[FMA4-59]
|
||||||
_ = x[FP256-60]
|
_ = x[FP128-60]
|
||||||
_ = x[FSRM-61]
|
_ = x[FP256-61]
|
||||||
_ = x[FXSR-62]
|
_ = x[FSRM-62]
|
||||||
_ = x[FXSROPT-63]
|
_ = x[FXSR-63]
|
||||||
_ = x[GFNI-64]
|
_ = x[FXSROPT-64]
|
||||||
_ = x[HLE-65]
|
_ = x[GFNI-65]
|
||||||
_ = x[HRESET-66]
|
_ = x[HLE-66]
|
||||||
_ = x[HTT-67]
|
_ = x[HRESET-67]
|
||||||
_ = x[HWA-68]
|
_ = x[HTT-68]
|
||||||
_ = x[HYBRID_CPU-69]
|
_ = x[HWA-69]
|
||||||
_ = x[HYPERVISOR-70]
|
_ = x[HYBRID_CPU-70]
|
||||||
_ = x[IA32_ARCH_CAP-71]
|
_ = x[HYPERVISOR-71]
|
||||||
_ = x[IA32_CORE_CAP-72]
|
_ = x[IA32_ARCH_CAP-72]
|
||||||
_ = x[IBPB-73]
|
_ = x[IA32_CORE_CAP-73]
|
||||||
_ = x[IBPB_BRTYPE-74]
|
_ = x[IBPB-74]
|
||||||
_ = x[IBRS-75]
|
_ = x[IBPB_BRTYPE-75]
|
||||||
_ = x[IBRS_PREFERRED-76]
|
_ = x[IBRS-76]
|
||||||
_ = x[IBRS_PROVIDES_SMP-77]
|
_ = x[IBRS_PREFERRED-77]
|
||||||
_ = x[IBS-78]
|
_ = x[IBRS_PROVIDES_SMP-78]
|
||||||
_ = x[IBSBRNTRGT-79]
|
_ = x[IBS-79]
|
||||||
_ = x[IBSFETCHSAM-80]
|
_ = x[IBSBRNTRGT-80]
|
||||||
_ = x[IBSFFV-81]
|
_ = x[IBSFETCHSAM-81]
|
||||||
_ = x[IBSOPCNT-82]
|
_ = x[IBSFFV-82]
|
||||||
_ = x[IBSOPCNTEXT-83]
|
_ = x[IBSOPCNT-83]
|
||||||
_ = x[IBSOPSAM-84]
|
_ = x[IBSOPCNTEXT-84]
|
||||||
_ = x[IBSRDWROPCNT-85]
|
_ = x[IBSOPSAM-85]
|
||||||
_ = x[IBSRIPINVALIDCHK-86]
|
_ = x[IBSRDWROPCNT-86]
|
||||||
_ = x[IBS_FETCH_CTLX-87]
|
_ = x[IBSRIPINVALIDCHK-87]
|
||||||
_ = x[IBS_OPDATA4-88]
|
_ = x[IBS_FETCH_CTLX-88]
|
||||||
_ = x[IBS_OPFUSE-89]
|
_ = x[IBS_OPDATA4-89]
|
||||||
_ = x[IBS_PREVENTHOST-90]
|
_ = x[IBS_OPFUSE-90]
|
||||||
_ = x[IBS_ZEN4-91]
|
_ = x[IBS_PREVENTHOST-91]
|
||||||
_ = x[IDPRED_CTRL-92]
|
_ = x[IBS_ZEN4-92]
|
||||||
_ = x[INT_WBINVD-93]
|
_ = x[IDPRED_CTRL-93]
|
||||||
_ = x[INVLPGB-94]
|
_ = x[INT_WBINVD-94]
|
||||||
_ = x[KEYLOCKER-95]
|
_ = x[INVLPGB-95]
|
||||||
_ = x[KEYLOCKERW-96]
|
_ = x[KEYLOCKER-96]
|
||||||
_ = x[LAHF-97]
|
_ = x[KEYLOCKERW-97]
|
||||||
_ = x[LAM-98]
|
_ = x[LAHF-98]
|
||||||
_ = x[LBRVIRT-99]
|
_ = x[LAM-99]
|
||||||
_ = x[LZCNT-100]
|
_ = x[LBRVIRT-100]
|
||||||
_ = x[MCAOVERFLOW-101]
|
_ = x[LZCNT-101]
|
||||||
_ = x[MCDT_NO-102]
|
_ = x[MCAOVERFLOW-102]
|
||||||
_ = x[MCOMMIT-103]
|
_ = x[MCDT_NO-103]
|
||||||
_ = x[MD_CLEAR-104]
|
_ = x[MCOMMIT-104]
|
||||||
_ = x[MMX-105]
|
_ = x[MD_CLEAR-105]
|
||||||
_ = x[MMXEXT-106]
|
_ = x[MMX-106]
|
||||||
_ = x[MOVBE-107]
|
_ = x[MMXEXT-107]
|
||||||
_ = x[MOVDIR64B-108]
|
_ = x[MOVBE-108]
|
||||||
_ = x[MOVDIRI-109]
|
_ = x[MOVDIR64B-109]
|
||||||
_ = x[MOVSB_ZL-110]
|
_ = x[MOVDIRI-110]
|
||||||
_ = x[MOVU-111]
|
_ = x[MOVSB_ZL-111]
|
||||||
_ = x[MPX-112]
|
_ = x[MOVU-112]
|
||||||
_ = x[MSRIRC-113]
|
_ = x[MPX-113]
|
||||||
_ = x[MSRLIST-114]
|
_ = x[MSRIRC-114]
|
||||||
_ = x[MSR_PAGEFLUSH-115]
|
_ = x[MSRLIST-115]
|
||||||
_ = x[NRIPS-116]
|
_ = x[MSR_PAGEFLUSH-116]
|
||||||
_ = x[NX-117]
|
_ = x[NRIPS-117]
|
||||||
_ = x[OSXSAVE-118]
|
_ = x[NX-118]
|
||||||
_ = x[PCONFIG-119]
|
_ = x[OSXSAVE-119]
|
||||||
_ = x[POPCNT-120]
|
_ = x[PCONFIG-120]
|
||||||
_ = x[PPIN-121]
|
_ = x[POPCNT-121]
|
||||||
_ = x[PREFETCHI-122]
|
_ = x[PPIN-122]
|
||||||
_ = x[PSFD-123]
|
_ = x[PREFETCHI-123]
|
||||||
_ = x[RDPRU-124]
|
_ = x[PSFD-124]
|
||||||
_ = x[RDRAND-125]
|
_ = x[RDPRU-125]
|
||||||
_ = x[RDSEED-126]
|
_ = x[RDRAND-126]
|
||||||
_ = x[RDTSCP-127]
|
_ = x[RDSEED-127]
|
||||||
_ = x[RRSBA_CTRL-128]
|
_ = x[RDTSCP-128]
|
||||||
_ = x[RTM-129]
|
_ = x[RRSBA_CTRL-129]
|
||||||
_ = x[RTM_ALWAYS_ABORT-130]
|
_ = x[RTM-130]
|
||||||
_ = x[SBPB-131]
|
_ = x[RTM_ALWAYS_ABORT-131]
|
||||||
_ = x[SERIALIZE-132]
|
_ = x[SBPB-132]
|
||||||
_ = x[SEV-133]
|
_ = x[SERIALIZE-133]
|
||||||
_ = x[SEV_64BIT-134]
|
_ = x[SEV-134]
|
||||||
_ = x[SEV_ALTERNATIVE-135]
|
_ = x[SEV_64BIT-135]
|
||||||
_ = x[SEV_DEBUGSWAP-136]
|
_ = x[SEV_ALTERNATIVE-136]
|
||||||
_ = x[SEV_ES-137]
|
_ = x[SEV_DEBUGSWAP-137]
|
||||||
_ = x[SEV_RESTRICTED-138]
|
_ = x[SEV_ES-138]
|
||||||
_ = x[SEV_SNP-139]
|
_ = x[SEV_RESTRICTED-139]
|
||||||
_ = x[SGX-140]
|
_ = x[SEV_SNP-140]
|
||||||
_ = x[SGXLC-141]
|
_ = x[SGX-141]
|
||||||
_ = x[SHA-142]
|
_ = x[SGXLC-142]
|
||||||
_ = x[SME-143]
|
_ = x[SHA-143]
|
||||||
_ = x[SME_COHERENT-144]
|
_ = x[SME-144]
|
||||||
_ = x[SPEC_CTRL_SSBD-145]
|
_ = x[SME_COHERENT-145]
|
||||||
_ = x[SRBDS_CTRL-146]
|
_ = x[SPEC_CTRL_SSBD-146]
|
||||||
_ = x[SRSO_MSR_FIX-147]
|
_ = x[SRBDS_CTRL-147]
|
||||||
_ = x[SRSO_NO-148]
|
_ = x[SRSO_MSR_FIX-148]
|
||||||
_ = x[SRSO_USER_KERNEL_NO-149]
|
_ = x[SRSO_NO-149]
|
||||||
_ = x[SSE-150]
|
_ = x[SRSO_USER_KERNEL_NO-150]
|
||||||
_ = x[SSE2-151]
|
_ = x[SSE-151]
|
||||||
_ = x[SSE3-152]
|
_ = x[SSE2-152]
|
||||||
_ = x[SSE4-153]
|
_ = x[SSE3-153]
|
||||||
_ = x[SSE42-154]
|
_ = x[SSE4-154]
|
||||||
_ = x[SSE4A-155]
|
_ = x[SSE42-155]
|
||||||
_ = x[SSSE3-156]
|
_ = x[SSE4A-156]
|
||||||
_ = x[STIBP-157]
|
_ = x[SSSE3-157]
|
||||||
_ = x[STIBP_ALWAYSON-158]
|
_ = x[STIBP-158]
|
||||||
_ = x[STOSB_SHORT-159]
|
_ = x[STIBP_ALWAYSON-159]
|
||||||
_ = x[SUCCOR-160]
|
_ = x[STOSB_SHORT-160]
|
||||||
_ = x[SVM-161]
|
_ = x[SUCCOR-161]
|
||||||
_ = x[SVMDA-162]
|
_ = x[SVM-162]
|
||||||
_ = x[SVMFBASID-163]
|
_ = x[SVMDA-163]
|
||||||
_ = x[SVML-164]
|
_ = x[SVMFBASID-164]
|
||||||
_ = x[SVMNP-165]
|
_ = x[SVML-165]
|
||||||
_ = x[SVMPF-166]
|
_ = x[SVMNP-166]
|
||||||
_ = x[SVMPFT-167]
|
_ = x[SVMPF-167]
|
||||||
_ = x[SYSCALL-168]
|
_ = x[SVMPFT-168]
|
||||||
_ = x[SYSEE-169]
|
_ = x[SYSCALL-169]
|
||||||
_ = x[TBM-170]
|
_ = x[SYSEE-170]
|
||||||
_ = x[TDX_GUEST-171]
|
_ = x[TBM-171]
|
||||||
_ = x[TLB_FLUSH_NESTED-172]
|
_ = x[TDX_GUEST-172]
|
||||||
_ = x[TME-173]
|
_ = x[TLB_FLUSH_NESTED-173]
|
||||||
_ = x[TOPEXT-174]
|
_ = x[TME-174]
|
||||||
_ = x[TSCRATEMSR-175]
|
_ = x[TOPEXT-175]
|
||||||
_ = x[TSXLDTRK-176]
|
_ = x[TSCRATEMSR-176]
|
||||||
_ = x[VAES-177]
|
_ = x[TSXLDTRK-177]
|
||||||
_ = x[VMCBCLEAN-178]
|
_ = x[VAES-178]
|
||||||
_ = x[VMPL-179]
|
_ = x[VMCBCLEAN-179]
|
||||||
_ = x[VMSA_REGPROT-180]
|
_ = x[VMPL-180]
|
||||||
_ = x[VMX-181]
|
_ = x[VMSA_REGPROT-181]
|
||||||
_ = x[VPCLMULQDQ-182]
|
_ = x[VMX-182]
|
||||||
_ = x[VTE-183]
|
_ = x[VPCLMULQDQ-183]
|
||||||
_ = x[WAITPKG-184]
|
_ = x[VTE-184]
|
||||||
_ = x[WBNOINVD-185]
|
_ = x[WAITPKG-185]
|
||||||
_ = x[WRMSRNS-186]
|
_ = x[WBNOINVD-186]
|
||||||
_ = x[X87-187]
|
_ = x[WRMSRNS-187]
|
||||||
_ = x[XGETBV1-188]
|
_ = x[X87-188]
|
||||||
_ = x[XOP-189]
|
_ = x[XGETBV1-189]
|
||||||
_ = x[XSAVE-190]
|
_ = x[XOP-190]
|
||||||
_ = x[XSAVEC-191]
|
_ = x[XSAVE-191]
|
||||||
_ = x[XSAVEOPT-192]
|
_ = x[XSAVEC-192]
|
||||||
_ = x[XSAVES-193]
|
_ = x[XSAVEOPT-193]
|
||||||
_ = x[AESARM-194]
|
_ = x[XSAVES-194]
|
||||||
_ = x[ARMCPUID-195]
|
_ = x[AESARM-195]
|
||||||
_ = x[ASIMD-196]
|
_ = x[ARMCPUID-196]
|
||||||
_ = x[ASIMDDP-197]
|
_ = x[ASIMD-197]
|
||||||
_ = x[ASIMDHP-198]
|
_ = x[ASIMDDP-198]
|
||||||
_ = x[ASIMDRDM-199]
|
_ = x[ASIMDHP-199]
|
||||||
_ = x[ATOMICS-200]
|
_ = x[ASIMDRDM-200]
|
||||||
_ = x[CRC32-201]
|
_ = x[ATOMICS-201]
|
||||||
_ = x[DCPOP-202]
|
_ = x[CRC32-202]
|
||||||
_ = x[EVTSTRM-203]
|
_ = x[DCPOP-203]
|
||||||
_ = x[FCMA-204]
|
_ = x[EVTSTRM-204]
|
||||||
_ = x[FP-205]
|
_ = x[FCMA-205]
|
||||||
_ = x[FPHP-206]
|
_ = x[FP-206]
|
||||||
_ = x[GPA-207]
|
_ = x[FPHP-207]
|
||||||
_ = x[JSCVT-208]
|
_ = x[GPA-208]
|
||||||
_ = x[LRCPC-209]
|
_ = x[JSCVT-209]
|
||||||
_ = x[PMULL-210]
|
_ = x[LRCPC-210]
|
||||||
_ = x[SHA1-211]
|
_ = x[PMULL-211]
|
||||||
_ = x[SHA2-212]
|
_ = x[SHA1-212]
|
||||||
_ = x[SHA3-213]
|
_ = x[SHA2-213]
|
||||||
_ = x[SHA512-214]
|
_ = x[SHA3-214]
|
||||||
_ = x[SM3-215]
|
_ = x[SHA512-215]
|
||||||
_ = x[SM4-216]
|
_ = x[SM3-216]
|
||||||
_ = x[SVE-217]
|
_ = x[SM4-217]
|
||||||
_ = x[lastID-218]
|
_ = x[SVE-218]
|
||||||
|
_ = x[lastID-219]
|
||||||
_ = x[firstID-0]
|
_ = x[firstID-0]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXTILEAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSHASMESME_COHERENTSPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFPFPHPGPAJSCVTLRCPCPMULLSHA1SHA2SHA3SHA512SM3SM4SVElastID"
|
const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXTILEAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8AVXVNNIINT16BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSHASMESME_COHERENTSPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFPFPHPGPAJSCVTLRCPCPMULLSHA1SHA2SHA3SHA512SM3SM4SVElastID"
|
||||||
|
|
||||||
var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 62, 67, 70, 75, 84, 93, 102, 106, 116, 128, 136, 144, 152, 160, 167, 177, 187, 195, 205, 216, 224, 234, 252, 267, 274, 286, 293, 300, 311, 319, 323, 327, 333, 338, 346, 351, 357, 361, 370, 388, 396, 403, 407, 411, 425, 431, 435, 439, 448, 452, 456, 461, 466, 470, 474, 481, 485, 488, 494, 497, 500, 510, 520, 533, 546, 550, 561, 565, 579, 596, 599, 609, 620, 626, 634, 645, 653, 665, 681, 695, 706, 716, 731, 739, 750, 760, 767, 776, 786, 790, 793, 800, 805, 816, 823, 830, 838, 841, 847, 852, 861, 868, 876, 880, 883, 889, 896, 909, 914, 916, 923, 930, 936, 940, 949, 953, 958, 964, 970, 976, 986, 989, 1005, 1009, 1018, 1021, 1030, 1045, 1058, 1064, 1078, 1085, 1088, 1093, 1096, 1099, 1111, 1125, 1135, 1147, 1154, 1173, 1176, 1180, 1184, 1188, 1193, 1198, 1203, 1208, 1222, 1233, 1239, 1242, 1247, 1256, 1260, 1265, 1270, 1276, 1283, 1288, 1291, 1300, 1316, 1319, 1325, 1335, 1343, 1347, 1356, 1360, 1372, 1375, 1385, 1388, 1395, 1403, 1410, 1413, 1420, 1423, 1428, 1434, 1442, 1448, 1454, 1462, 1467, 1474, 1481, 1489, 1496, 1501, 1506, 1513, 1517, 1519, 1523, 1526, 1531, 1536, 1541, 1545, 1549, 1553, 1559, 1562, 1565, 1568, 1574}
|
var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 62, 67, 70, 75, 84, 93, 102, 106, 116, 128, 136, 144, 152, 160, 167, 177, 187, 195, 205, 216, 224, 234, 252, 267, 274, 286, 293, 300, 311, 323, 331, 335, 339, 345, 350, 358, 363, 369, 373, 382, 400, 408, 415, 419, 423, 437, 443, 447, 451, 460, 464, 468, 473, 478, 482, 486, 493, 497, 500, 506, 509, 512, 522, 532, 545, 558, 562, 573, 577, 591, 608, 611, 621, 632, 638, 646, 657, 665, 677, 693, 707, 718, 728, 743, 751, 762, 772, 779, 788, 798, 802, 805, 812, 817, 828, 835, 842, 850, 853, 859, 864, 873, 880, 888, 892, 895, 901, 908, 921, 926, 928, 935, 942, 948, 952, 961, 965, 970, 976, 982, 988, 998, 1001, 1017, 1021, 1030, 1033, 1042, 1057, 1070, 1076, 1090, 1097, 1100, 1105, 1108, 1111, 1123, 1137, 1147, 1159, 1166, 1185, 1188, 1192, 1196, 1200, 1205, 1210, 1215, 1220, 1234, 1245, 1251, 1254, 1259, 1268, 1272, 1277, 1282, 1288, 1295, 1300, 1303, 1312, 1328, 1331, 1337, 1347, 1355, 1359, 1368, 1372, 1384, 1387, 1397, 1400, 1407, 1415, 1422, 1425, 1432, 1435, 1440, 1446, 1454, 1460, 1466, 1474, 1479, 1486, 1493, 1501, 1508, 1513, 1518, 1525, 1529, 1531, 1535, 1538, 1543, 1548, 1553, 1557, 1561, 1565, 1571, 1574, 1577, 1580, 1586}
|
||||||
|
|
||||||
func (i FeatureID) String() string {
|
func (i FeatureID) String() string {
|
||||||
if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) {
|
if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) {
|
||||||
|
|||||||
+35
-55
@@ -133,9 +133,9 @@ type Agent struct {
|
|||||||
gatherCandidateCancel func()
|
gatherCandidateCancel func()
|
||||||
gatherCandidateDone chan struct{}
|
gatherCandidateDone chan struct{}
|
||||||
|
|
||||||
chanCandidate chan Candidate
|
connectionStateNotifier *handlerNotifier
|
||||||
chanCandidatePair chan *CandidatePair
|
candidateNotifier *handlerNotifier
|
||||||
chanState chan ConnectionState
|
selectedCandidatePairNotifier *handlerNotifier
|
||||||
|
|
||||||
loggerFactory logging.LoggerFactory
|
loggerFactory logging.LoggerFactory
|
||||||
log logging.LeveledLogger
|
log logging.LeveledLogger
|
||||||
@@ -232,9 +232,6 @@ func (a *Agent) taskLoop() {
|
|||||||
|
|
||||||
after()
|
after()
|
||||||
|
|
||||||
close(a.chanState)
|
|
||||||
close(a.chanCandidate)
|
|
||||||
close(a.chanCandidatePair)
|
|
||||||
close(a.taskLoopDone)
|
close(a.taskLoopDone)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -282,33 +279,30 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
|
|||||||
startedCtx, startedFn := context.WithCancel(context.Background())
|
startedCtx, startedFn := context.WithCancel(context.Background())
|
||||||
|
|
||||||
a := &Agent{
|
a := &Agent{
|
||||||
chanTask: make(chan task),
|
chanTask: make(chan task),
|
||||||
chanState: make(chan ConnectionState),
|
tieBreaker: globalMathRandomGenerator.Uint64(),
|
||||||
chanCandidate: make(chan Candidate),
|
lite: config.Lite,
|
||||||
chanCandidatePair: make(chan *CandidatePair),
|
gatheringState: GatheringStateNew,
|
||||||
tieBreaker: globalMathRandomGenerator.Uint64(),
|
connectionState: ConnectionStateNew,
|
||||||
lite: config.Lite,
|
localCandidates: make(map[NetworkType][]Candidate),
|
||||||
gatheringState: GatheringStateNew,
|
remoteCandidates: make(map[NetworkType][]Candidate),
|
||||||
connectionState: ConnectionStateNew,
|
urls: config.Urls,
|
||||||
localCandidates: make(map[NetworkType][]Candidate),
|
networkTypes: config.NetworkTypes,
|
||||||
remoteCandidates: make(map[NetworkType][]Candidate),
|
onConnected: make(chan struct{}),
|
||||||
urls: config.Urls,
|
buf: packetio.NewBuffer(),
|
||||||
networkTypes: config.NetworkTypes,
|
done: make(chan struct{}),
|
||||||
onConnected: make(chan struct{}),
|
taskLoopDone: make(chan struct{}),
|
||||||
buf: packetio.NewBuffer(),
|
startedCh: startedCtx.Done(),
|
||||||
done: make(chan struct{}),
|
startedFn: startedFn,
|
||||||
taskLoopDone: make(chan struct{}),
|
portMin: config.PortMin,
|
||||||
startedCh: startedCtx.Done(),
|
portMax: config.PortMax,
|
||||||
startedFn: startedFn,
|
loggerFactory: loggerFactory,
|
||||||
portMin: config.PortMin,
|
log: log,
|
||||||
portMax: config.PortMax,
|
net: config.Net,
|
||||||
loggerFactory: loggerFactory,
|
proxyDialer: config.ProxyDialer,
|
||||||
log: log,
|
tcpMux: config.TCPMux,
|
||||||
net: config.Net,
|
udpMux: config.UDPMux,
|
||||||
proxyDialer: config.ProxyDialer,
|
udpMuxSrflx: config.UDPMuxSrflx,
|
||||||
tcpMux: config.TCPMux,
|
|
||||||
udpMux: config.UDPMux,
|
|
||||||
udpMuxSrflx: config.UDPMuxSrflx,
|
|
||||||
|
|
||||||
mDNSMode: mDNSMode,
|
mDNSMode: mDNSMode,
|
||||||
mDNSName: mDNSName,
|
mDNSName: mDNSName,
|
||||||
@@ -329,6 +323,9 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
|
|||||||
|
|
||||||
userBindingRequestHandler: config.BindingRequestHandler,
|
userBindingRequestHandler: config.BindingRequestHandler,
|
||||||
}
|
}
|
||||||
|
a.connectionStateNotifier = &handlerNotifier{connectionStateFunc: a.onConnectionStateChange}
|
||||||
|
a.candidateNotifier = &handlerNotifier{candidateFunc: a.onCandidate}
|
||||||
|
a.selectedCandidatePairNotifier = &handlerNotifier{candidatePairFunc: a.onSelectedCandidatePairChange}
|
||||||
|
|
||||||
if a.net == nil {
|
if a.net == nil {
|
||||||
a.net, err = stdnet.NewNet()
|
a.net, err = stdnet.NewNet()
|
||||||
@@ -372,13 +369,6 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
|
|||||||
|
|
||||||
go a.taskLoop()
|
go a.taskLoop()
|
||||||
|
|
||||||
// CandidatePair and ConnectionState are usually changed at once.
|
|
||||||
// Blocking one by the other one causes deadlock.
|
|
||||||
// Hence, we call handlers from independent Goroutines.
|
|
||||||
go a.candidatePairRoutine()
|
|
||||||
go a.connectionStateRoutine()
|
|
||||||
go a.candidateRoutine()
|
|
||||||
|
|
||||||
// Restart is also used to initialize the agent for the first time
|
// Restart is also used to initialize the agent for the first time
|
||||||
if err := a.Restart(config.LocalUfrag, config.LocalPwd); err != nil {
|
if err := a.Restart(config.LocalUfrag, config.LocalPwd); err != nil {
|
||||||
a.closeMulticastConn()
|
a.closeMulticastConn()
|
||||||
@@ -516,12 +506,7 @@ func (a *Agent) updateConnectionState(newState ConnectionState) {
|
|||||||
|
|
||||||
a.log.Infof("Setting new connection state: %s", newState)
|
a.log.Infof("Setting new connection state: %s", newState)
|
||||||
a.connectionState = newState
|
a.connectionState = newState
|
||||||
|
a.connectionStateNotifier.EnqueueConnectionState(newState)
|
||||||
// Call handler after finishing current task since we may be holding the agent lock
|
|
||||||
// and the handler may also require it
|
|
||||||
a.afterRun(func(ctx context.Context) {
|
|
||||||
a.chanState <- newState
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,12 +525,7 @@ func (a *Agent) setSelectedPair(p *CandidatePair) {
|
|||||||
a.updateConnectionState(ConnectionStateConnected)
|
a.updateConnectionState(ConnectionStateConnected)
|
||||||
|
|
||||||
// Notify when the selected pair changes
|
// Notify when the selected pair changes
|
||||||
a.afterRun(func(ctx context.Context) {
|
a.selectedCandidatePairNotifier.EnqueueSelectedCandidatePair(p)
|
||||||
select {
|
|
||||||
case a.chanCandidatePair <- p:
|
|
||||||
case <-ctx.Done():
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Signal connected
|
// Signal connected
|
||||||
a.onConnectedOnce.Do(func() { close(a.onConnected) })
|
a.onConnectedOnce.Do(func() { close(a.onConnected) })
|
||||||
@@ -781,7 +761,7 @@ func (a *Agent) addRemotePassiveTCPCandidate(remoteCandidate Candidate) {
|
|||||||
|
|
||||||
localCandidate.start(a, conn, a.startedCh)
|
localCandidate.start(a, conn, a.startedCh)
|
||||||
a.localCandidates[localCandidate.NetworkType()] = append(a.localCandidates[localCandidate.NetworkType()], localCandidate)
|
a.localCandidates[localCandidate.NetworkType()] = append(a.localCandidates[localCandidate.NetworkType()], localCandidate)
|
||||||
a.chanCandidate <- localCandidate
|
a.candidateNotifier.EnqueueCandidate(localCandidate)
|
||||||
|
|
||||||
a.addPair(localCandidate, remoteCandidate)
|
a.addPair(localCandidate, remoteCandidate)
|
||||||
}
|
}
|
||||||
@@ -851,7 +831,7 @@ func (a *Agent) addCandidate(ctx context.Context, c Candidate, candidateConn net
|
|||||||
|
|
||||||
a.requestConnectivityCheck()
|
a.requestConnectivityCheck()
|
||||||
|
|
||||||
a.chanCandidate <- c
|
a.candidateNotifier.EnqueueCandidate(c)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1287,7 +1267,7 @@ func (a *Agent) setGatheringState(newState GatheringState) error {
|
|||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
if err := a.run(a.context(), func(ctx context.Context, agent *Agent) {
|
if err := a.run(a.context(), func(ctx context.Context, agent *Agent) {
|
||||||
if a.gatheringState != newState && newState == GatheringStateComplete {
|
if a.gatheringState != newState && newState == GatheringStateComplete {
|
||||||
a.chanCandidate <- nil
|
a.candidateNotifier.EnqueueCandidate(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
a.gatheringState = newState
|
a.gatheringState = newState
|
||||||
|
|||||||
+85
-9
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
package ice
|
package ice
|
||||||
|
|
||||||
|
import "sync"
|
||||||
|
|
||||||
// OnConnectionStateChange sets a handler that is fired when the connection state changes
|
// OnConnectionStateChange sets a handler that is fired when the connection state changes
|
||||||
func (a *Agent) OnConnectionStateChange(f func(ConnectionState)) error {
|
func (a *Agent) OnConnectionStateChange(f func(ConnectionState)) error {
|
||||||
a.onConnectionStateChangeHdlr.Store(f)
|
a.onConnectionStateChangeHdlr.Store(f)
|
||||||
@@ -41,20 +43,94 @@ func (a *Agent) onConnectionStateChange(s ConnectionState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) candidatePairRoutine() {
|
type handlerNotifier struct {
|
||||||
for p := range a.chanCandidatePair {
|
sync.Mutex
|
||||||
a.onSelectedCandidatePairChange(p)
|
running bool
|
||||||
|
|
||||||
|
connectionStates []ConnectionState
|
||||||
|
connectionStateFunc func(ConnectionState)
|
||||||
|
|
||||||
|
candidates []Candidate
|
||||||
|
candidateFunc func(Candidate)
|
||||||
|
|
||||||
|
selectedCandidatePairs []*CandidatePair
|
||||||
|
candidatePairFunc func(*CandidatePair)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *handlerNotifier) EnqueueConnectionState(s ConnectionState) {
|
||||||
|
h.Lock()
|
||||||
|
defer h.Unlock()
|
||||||
|
|
||||||
|
notify := func() {
|
||||||
|
for {
|
||||||
|
h.Lock()
|
||||||
|
if len(h.connectionStates) == 0 {
|
||||||
|
h.running = false
|
||||||
|
h.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
notification := h.connectionStates[0]
|
||||||
|
h.connectionStates = h.connectionStates[1:]
|
||||||
|
h.Unlock()
|
||||||
|
h.connectionStateFunc(notification)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h.connectionStates = append(h.connectionStates, s)
|
||||||
|
if !h.running {
|
||||||
|
h.running = true
|
||||||
|
go notify()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) connectionStateRoutine() {
|
func (h *handlerNotifier) EnqueueCandidate(c Candidate) {
|
||||||
for s := range a.chanState {
|
h.Lock()
|
||||||
go a.onConnectionStateChange(s)
|
defer h.Unlock()
|
||||||
|
|
||||||
|
notify := func() {
|
||||||
|
for {
|
||||||
|
h.Lock()
|
||||||
|
if len(h.candidates) == 0 {
|
||||||
|
h.running = false
|
||||||
|
h.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
notification := h.candidates[0]
|
||||||
|
h.candidates = h.candidates[1:]
|
||||||
|
h.Unlock()
|
||||||
|
h.candidateFunc(notification)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h.candidates = append(h.candidates, c)
|
||||||
|
if !h.running {
|
||||||
|
h.running = true
|
||||||
|
go notify()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) candidateRoutine() {
|
func (h *handlerNotifier) EnqueueSelectedCandidatePair(p *CandidatePair) {
|
||||||
for c := range a.chanCandidate {
|
h.Lock()
|
||||||
a.onCandidate(c)
|
defer h.Unlock()
|
||||||
|
|
||||||
|
notify := func() {
|
||||||
|
for {
|
||||||
|
h.Lock()
|
||||||
|
if len(h.selectedCandidatePairs) == 0 {
|
||||||
|
h.running = false
|
||||||
|
h.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
notification := h.selectedCandidatePairs[0]
|
||||||
|
h.selectedCandidatePairs = h.selectedCandidatePairs[1:]
|
||||||
|
h.Unlock()
|
||||||
|
h.candidatePairFunc(notification)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h.selectedCandidatePairs = append(h.selectedCandidatePairs, p)
|
||||||
|
if !h.running {
|
||||||
|
h.running = true
|
||||||
|
go notify()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-8
@@ -31,8 +31,8 @@ type candidateBase struct {
|
|||||||
|
|
||||||
resolvedAddr net.Addr
|
resolvedAddr net.Addr
|
||||||
|
|
||||||
lastSent atomic.Int64
|
lastSent atomic.Value
|
||||||
lastReceived atomic.Int64
|
lastReceived atomic.Value
|
||||||
conn net.PacketConn
|
conn net.PacketConn
|
||||||
|
|
||||||
currAgent *Agent
|
currAgent *Agent
|
||||||
@@ -400,27 +400,27 @@ func (c *candidateBase) String() string {
|
|||||||
// LastReceived returns a time.Time indicating the last time
|
// LastReceived returns a time.Time indicating the last time
|
||||||
// this candidate was received
|
// this candidate was received
|
||||||
func (c *candidateBase) LastReceived() time.Time {
|
func (c *candidateBase) LastReceived() time.Time {
|
||||||
if lastReceived := c.lastReceived.Load(); lastReceived != 0 {
|
if lastReceived, ok := c.lastReceived.Load().(time.Time); ok {
|
||||||
return time.Unix(0, lastReceived)
|
return lastReceived
|
||||||
}
|
}
|
||||||
return time.Time{}
|
return time.Time{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *candidateBase) setLastReceived(t time.Time) {
|
func (c *candidateBase) setLastReceived(t time.Time) {
|
||||||
c.lastReceived.Store(t.UnixNano())
|
c.lastReceived.Store(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LastSent returns a time.Time indicating the last time
|
// LastSent returns a time.Time indicating the last time
|
||||||
// this candidate was sent
|
// this candidate was sent
|
||||||
func (c *candidateBase) LastSent() time.Time {
|
func (c *candidateBase) LastSent() time.Time {
|
||||||
if lastSent := c.lastSent.Load(); lastSent != 0 {
|
if lastSent, ok := c.lastSent.Load().(time.Time); ok {
|
||||||
return time.Unix(0, lastSent)
|
return lastSent
|
||||||
}
|
}
|
||||||
return time.Time{}
|
return time.Time{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *candidateBase) setLastSent(t time.Time) {
|
func (c *candidateBase) setLastSent(t time.Time) {
|
||||||
c.lastSent.Store(t.UnixNano())
|
c.lastSent.Store(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *candidateBase) seen(outbound bool) {
|
func (c *candidateBase) seen(outbound bool) {
|
||||||
|
|||||||
+13
@@ -109,6 +109,19 @@ func ConfigureTWCCSender(mediaEngine *MediaEngine, interceptorRegistry *intercep
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConfigureSimulcastExtensionHeaders enables the RTP Extension Headers needed for Simulcast
|
||||||
|
func ConfigureSimulcastExtensionHeaders(mediaEngine *MediaEngine) error {
|
||||||
|
if err := mediaEngine.RegisterHeaderExtension(RTPHeaderExtensionCapability{URI: sdp.SDESMidURI}, RTPCodecTypeVideo); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := mediaEngine.RegisterHeaderExtension(RTPHeaderExtensionCapability{URI: sdp.SDESRTPStreamIDURI}, RTPCodecTypeVideo); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return mediaEngine.RegisterHeaderExtension(RTPHeaderExtensionCapability{URI: sdesRepairRTPStreamIDURI}, RTPCodecTypeVideo)
|
||||||
|
}
|
||||||
|
|
||||||
type interceptorToTrackLocalWriter struct{ interceptor atomic.Value } // interceptor.RTPWriter }
|
type interceptorToTrackLocalWriter struct{ interceptor atomic.Value } // interceptor.RTPWriter }
|
||||||
|
|
||||||
func (i *interceptorToTrackLocalWriter) WriteRTP(header *rtp.Header, payload []byte) (int, error) {
|
func (i *interceptorToTrackLocalWriter) WriteRTP(header *rtp.Header, payload []byte) (int, error) {
|
||||||
|
|||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package fmtp
|
||||||
|
|
||||||
|
type av1FMTP struct {
|
||||||
|
parameters map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *av1FMTP) MimeType() string {
|
||||||
|
return "video/av1"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *av1FMTP) Match(b FMTP) bool {
|
||||||
|
c, ok := b.(*av1FMTP)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// AV1 RTP specification:
|
||||||
|
// If the profile parameter is not present, it MUST be inferred to be 0 (“Main” profile).
|
||||||
|
hProfile, ok := h.parameters["profile"]
|
||||||
|
if !ok {
|
||||||
|
hProfile = "0"
|
||||||
|
}
|
||||||
|
cProfile, ok := c.parameters["profile"]
|
||||||
|
if !ok {
|
||||||
|
cProfile = "0"
|
||||||
|
}
|
||||||
|
if hProfile != cProfile {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *av1FMTP) Parameter(key string) (string, bool) {
|
||||||
|
v, ok := h.parameters[key]
|
||||||
|
return v, ok
|
||||||
|
}
|
||||||
+31
-14
@@ -8,6 +8,22 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func parseParameters(line string) map[string]string {
|
||||||
|
parameters := make(map[string]string)
|
||||||
|
|
||||||
|
for _, p := range strings.Split(line, ";") {
|
||||||
|
pp := strings.SplitN(strings.TrimSpace(p), "=", 2)
|
||||||
|
key := strings.ToLower(pp[0])
|
||||||
|
var value string
|
||||||
|
if len(pp) > 1 {
|
||||||
|
value = pp[1]
|
||||||
|
}
|
||||||
|
parameters[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
return parameters
|
||||||
|
}
|
||||||
|
|
||||||
// FMTP interface for implementing custom
|
// FMTP interface for implementing custom
|
||||||
// FMTP parsers based on MimeType
|
// FMTP parsers based on MimeType
|
||||||
type FMTP interface {
|
type FMTP interface {
|
||||||
@@ -23,29 +39,30 @@ type FMTP interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse parses an fmtp string based on the MimeType
|
// Parse parses an fmtp string based on the MimeType
|
||||||
func Parse(mimetype, line string) FMTP {
|
func Parse(mimeType, line string) FMTP {
|
||||||
var f FMTP
|
var f FMTP
|
||||||
|
|
||||||
parameters := make(map[string]string)
|
parameters := parseParameters(line)
|
||||||
|
|
||||||
for _, p := range strings.Split(line, ";") {
|
|
||||||
pp := strings.SplitN(strings.TrimSpace(p), "=", 2)
|
|
||||||
key := strings.ToLower(pp[0])
|
|
||||||
var value string
|
|
||||||
if len(pp) > 1 {
|
|
||||||
value = pp[1]
|
|
||||||
}
|
|
||||||
parameters[key] = value
|
|
||||||
}
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case strings.EqualFold(mimetype, "video/h264"):
|
case strings.EqualFold(mimeType, "video/h264"):
|
||||||
f = &h264FMTP{
|
f = &h264FMTP{
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case strings.EqualFold(mimeType, "video/vp9"):
|
||||||
|
f = &vp9FMTP{
|
||||||
|
parameters: parameters,
|
||||||
|
}
|
||||||
|
|
||||||
|
case strings.EqualFold(mimeType, "video/av1"):
|
||||||
|
f = &av1FMTP{
|
||||||
|
parameters: parameters,
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
f = &genericFMTP{
|
f = &genericFMTP{
|
||||||
mimeType: mimetype,
|
mimeType: mimeType,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package fmtp
|
||||||
|
|
||||||
|
type vp9FMTP struct {
|
||||||
|
parameters map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *vp9FMTP) MimeType() string {
|
||||||
|
return "video/vp9"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *vp9FMTP) Match(b FMTP) bool {
|
||||||
|
c, ok := b.(*vp9FMTP)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// draft-ietf-payload-vp9-16:
|
||||||
|
// If no profile-id is present, Profile 0 MUST be inferred
|
||||||
|
hProfileID, ok := h.parameters["profile-id"]
|
||||||
|
if !ok {
|
||||||
|
hProfileID = "0"
|
||||||
|
}
|
||||||
|
cProfileID, ok := c.parameters["profile-id"]
|
||||||
|
if !ok {
|
||||||
|
cProfileID = "0"
|
||||||
|
}
|
||||||
|
if hProfileID != cProfileID {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *vp9FMTP) Parameter(key string) (string, bool) {
|
||||||
|
v, ok := h.parameters[key]
|
||||||
|
return v, ok
|
||||||
|
}
|
||||||
+10
-10
@@ -307,6 +307,16 @@ func (pc *PeerConnection) onNegotiationNeeded() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (pc *PeerConnection) negotiationNeededOp() {
|
func (pc *PeerConnection) negotiationNeededOp() {
|
||||||
|
// non-canon, reset needed state machine and run again if there was a request
|
||||||
|
defer func() {
|
||||||
|
pc.mu.Lock()
|
||||||
|
defer pc.mu.Unlock()
|
||||||
|
if pc.negotiationNeededState == negotiationNeededStateQueue {
|
||||||
|
defer pc.onNegotiationNeeded()
|
||||||
|
}
|
||||||
|
pc.negotiationNeededState = negotiationNeededStateEmpty
|
||||||
|
}()
|
||||||
|
|
||||||
// Don't run NegotiatedNeeded checks if OnNegotiationNeeded is not set
|
// Don't run NegotiatedNeeded checks if OnNegotiationNeeded is not set
|
||||||
if handler, ok := pc.onNegotiationNeededHandler.Load().(func()); !ok || handler == nil {
|
if handler, ok := pc.onNegotiationNeededHandler.Load().(func()); !ok || handler == nil {
|
||||||
return
|
return
|
||||||
@@ -323,16 +333,6 @@ func (pc *PeerConnection) negotiationNeededOp() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// non-canon, run again if there was a request
|
|
||||||
defer func() {
|
|
||||||
pc.mu.Lock()
|
|
||||||
defer pc.mu.Unlock()
|
|
||||||
if pc.negotiationNeededState == negotiationNeededStateQueue {
|
|
||||||
defer pc.onNegotiationNeeded()
|
|
||||||
}
|
|
||||||
pc.negotiationNeededState = negotiationNeededStateEmpty
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Step 2.3
|
// Step 2.3
|
||||||
if pc.SignalingState() != SignalingStateStable {
|
if pc.SignalingState() != SignalingStateStable {
|
||||||
return
|
return
|
||||||
|
|||||||
+2
-1
@@ -153,7 +153,8 @@ func (t *TrackRemote) checkAndUpdateTrack(b []byte) error {
|
|||||||
return errRTPTooShort
|
return errRTPTooShort
|
||||||
}
|
}
|
||||||
|
|
||||||
if payloadType := PayloadType(b[1] & rtpPayloadTypeBitmask); payloadType != t.PayloadType() {
|
payloadType := PayloadType(b[1] & rtpPayloadTypeBitmask)
|
||||||
|
if payloadType != t.PayloadType() || len(t.params.Codecs) == 0 {
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
defer t.mu.Unlock()
|
defer t.mu.Unlock()
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,7 @@ var Error = errors.New("protobuf error")
|
|||||||
|
|
||||||
// New formats a string according to the format specifier and arguments and
|
// New formats a string according to the format specifier and arguments and
|
||||||
// returns an error that has a "proto" prefix.
|
// returns an error that has a "proto" prefix.
|
||||||
func New(f string, x ...interface{}) error {
|
func New(f string, x ...any) error {
|
||||||
return &prefixError{s: format(f, x...)}
|
return &prefixError{s: format(f, x...)}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ func (e *prefixError) Unwrap() error {
|
|||||||
|
|
||||||
// Wrap returns an error that has a "proto" prefix, the formatted string described
|
// Wrap returns an error that has a "proto" prefix, the formatted string described
|
||||||
// by the format specifier and arguments, and a suffix of err. The error wraps err.
|
// by the format specifier and arguments, and a suffix of err. The error wraps err.
|
||||||
func Wrap(err error, f string, x ...interface{}) error {
|
func Wrap(err error, f string, x ...any) error {
|
||||||
return &wrapError{
|
return &wrapError{
|
||||||
s: format(f, x...),
|
s: format(f, x...),
|
||||||
err: err,
|
err: err,
|
||||||
@@ -67,7 +67,7 @@ func (e *wrapError) Is(target error) bool {
|
|||||||
return target == Error
|
return target == Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func format(f string, x ...interface{}) string {
|
func format(f string, x ...any) string {
|
||||||
// avoid "proto: " prefix when chaining
|
// avoid "proto: " prefix when chaining
|
||||||
for i := 0; i < len(x); i++ {
|
for i := 0; i < len(x); i++ {
|
||||||
switch e := x[i].(type) {
|
switch e := x[i].(type) {
|
||||||
|
|||||||
+3
@@ -860,11 +860,13 @@ const (
|
|||||||
EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
EnumValueOptions_Features_field_name protoreflect.Name = "features"
|
EnumValueOptions_Features_field_name protoreflect.Name = "features"
|
||||||
EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
|
EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
|
||||||
|
EnumValueOptions_FeatureSupport_field_name protoreflect.Name = "feature_support"
|
||||||
EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
|
EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
|
||||||
EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features"
|
EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features"
|
||||||
EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact"
|
EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact"
|
||||||
|
EnumValueOptions_FeatureSupport_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.feature_support"
|
||||||
EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
|
EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -873,6 +875,7 @@ const (
|
|||||||
EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
|
EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
|
||||||
EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2
|
EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2
|
||||||
EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3
|
EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3
|
||||||
|
EnumValueOptions_FeatureSupport_field_number protoreflect.FieldNumber = 4
|
||||||
EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -18,7 +18,7 @@ type messageField struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var messageFieldPool = sync.Pool{
|
var messageFieldPool = sync.Pool{
|
||||||
New: func() interface{} { return new([]messageField) },
|
New: func() any { return new([]messageField) },
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -69,7 +69,7 @@ type mapEntry struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mapEntryPool = sync.Pool{
|
var mapEntryPool = sync.Pool{
|
||||||
New: func() interface{} { return new([]mapEntry) },
|
New: func() any { return new([]mapEntry) },
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|||||||
+3
-3
@@ -39,7 +39,7 @@ func ClearExtension(m Message, xt protoreflect.ExtensionType) {
|
|||||||
// If the field is unpopulated, it returns the default value for
|
// If the field is unpopulated, it returns the default value for
|
||||||
// scalars and an immutable, empty value for lists or messages.
|
// scalars and an immutable, empty value for lists or messages.
|
||||||
// It panics if xt does not extend m.
|
// It panics if xt does not extend m.
|
||||||
func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {
|
func GetExtension(m Message, xt protoreflect.ExtensionType) any {
|
||||||
// Treat nil message interface as an empty message; return the default.
|
// Treat nil message interface as an empty message; return the default.
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return xt.InterfaceOf(xt.Zero())
|
return xt.InterfaceOf(xt.Zero())
|
||||||
@@ -51,7 +51,7 @@ func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {
|
|||||||
// SetExtension stores the value of an extension field.
|
// SetExtension stores the value of an extension field.
|
||||||
// It panics if m is invalid, xt does not extend m, or if type of v
|
// It panics if m is invalid, xt does not extend m, or if type of v
|
||||||
// is invalid for the specified extension field.
|
// is invalid for the specified extension field.
|
||||||
func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {
|
func SetExtension(m Message, xt protoreflect.ExtensionType, v any) {
|
||||||
xd := xt.TypeDescriptor()
|
xd := xt.TypeDescriptor()
|
||||||
pv := xt.ValueOf(v)
|
pv := xt.ValueOf(v)
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {
|
|||||||
// It returns immediately if f returns false.
|
// It returns immediately if f returns false.
|
||||||
// While iterating, mutating operations may only be performed
|
// While iterating, mutating operations may only be performed
|
||||||
// on the current extension field.
|
// on the current extension field.
|
||||||
func RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) {
|
func RangeExtensions(m Message, f func(protoreflect.ExtensionType, any) bool) {
|
||||||
// Treat nil message interface as an empty message; nothing to range over.
|
// Treat nil message interface as an empty message; nothing to range over.
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return
|
return
|
||||||
|
|||||||
+2
@@ -485,6 +485,8 @@ func (p *SourcePath) appendEnumValueOptions(b []byte) []byte {
|
|||||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 3:
|
case 3:
|
||||||
b = p.appendSingularField(b, "debug_redact", nil)
|
b = p.appendSingularField(b, "debug_redact", nil)
|
||||||
|
case 4:
|
||||||
|
b = p.appendSingularField(b, "feature_support", (*SourcePath).appendFieldOptions_FeatureSupport)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -510,7 +510,7 @@ type ExtensionType interface {
|
|||||||
//
|
//
|
||||||
// ValueOf is more extensive than protoreflect.ValueOf for a given field's
|
// ValueOf is more extensive than protoreflect.ValueOf for a given field's
|
||||||
// value as it has more type information available.
|
// value as it has more type information available.
|
||||||
ValueOf(interface{}) Value
|
ValueOf(any) Value
|
||||||
|
|
||||||
// InterfaceOf completely unwraps the Value to the underlying Go type.
|
// InterfaceOf completely unwraps the Value to the underlying Go type.
|
||||||
// InterfaceOf panics if the input is nil or does not represent the
|
// InterfaceOf panics if the input is nil or does not represent the
|
||||||
@@ -519,13 +519,13 @@ type ExtensionType interface {
|
|||||||
//
|
//
|
||||||
// InterfaceOf is able to unwrap the Value further than Value.Interface
|
// InterfaceOf is able to unwrap the Value further than Value.Interface
|
||||||
// as it has more type information available.
|
// as it has more type information available.
|
||||||
InterfaceOf(Value) interface{}
|
InterfaceOf(Value) any
|
||||||
|
|
||||||
// IsValidValue reports whether the Value is valid to assign to the field.
|
// IsValidValue reports whether the Value is valid to assign to the field.
|
||||||
IsValidValue(Value) bool
|
IsValidValue(Value) bool
|
||||||
|
|
||||||
// IsValidInterface reports whether the input is valid to assign to the field.
|
// IsValidInterface reports whether the input is valid to assign to the field.
|
||||||
IsValidInterface(interface{}) bool
|
IsValidInterface(any) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnumDescriptor describes an enum and
|
// EnumDescriptor describes an enum and
|
||||||
|
|||||||
+7
-7
@@ -32,11 +32,11 @@ const (
|
|||||||
type value struct {
|
type value struct {
|
||||||
pragma.DoNotCompare // 0B
|
pragma.DoNotCompare // 0B
|
||||||
|
|
||||||
typ valueType // 8B
|
typ valueType // 8B
|
||||||
num uint64 // 8B
|
num uint64 // 8B
|
||||||
str string // 16B
|
str string // 16B
|
||||||
bin []byte // 24B
|
bin []byte // 24B
|
||||||
iface interface{} // 16B
|
iface any // 16B
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueOfString(v string) Value {
|
func valueOfString(v string) Value {
|
||||||
@@ -45,7 +45,7 @@ func valueOfString(v string) Value {
|
|||||||
func valueOfBytes(v []byte) Value {
|
func valueOfBytes(v []byte) Value {
|
||||||
return Value{typ: bytesType, bin: v}
|
return Value{typ: bytesType, bin: v}
|
||||||
}
|
}
|
||||||
func valueOfIface(v interface{}) Value {
|
func valueOfIface(v any) Value {
|
||||||
return Value{typ: ifaceType, iface: v}
|
return Value{typ: ifaceType, iface: v}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +55,6 @@ func (v Value) getString() string {
|
|||||||
func (v Value) getBytes() []byte {
|
func (v Value) getBytes() []byte {
|
||||||
return v.bin
|
return v.bin
|
||||||
}
|
}
|
||||||
func (v Value) getIface() interface{} {
|
func (v Value) getIface() any {
|
||||||
return v.iface
|
return v.iface
|
||||||
}
|
}
|
||||||
+7
-7
@@ -69,8 +69,8 @@ import (
|
|||||||
// composite Value. Modifying an empty, read-only value panics.
|
// composite Value. Modifying an empty, read-only value panics.
|
||||||
type Value value
|
type Value value
|
||||||
|
|
||||||
// The protoreflect API uses a custom Value union type instead of interface{}
|
// The protoreflect API uses a custom Value union type instead of any
|
||||||
// to keep the future open for performance optimizations. Using an interface{}
|
// to keep the future open for performance optimizations. Using an any
|
||||||
// always incurs an allocation for primitives (e.g., int64) since it needs to
|
// always incurs an allocation for primitives (e.g., int64) since it needs to
|
||||||
// be boxed on the heap (as interfaces can only contain pointers natively).
|
// be boxed on the heap (as interfaces can only contain pointers natively).
|
||||||
// Instead, we represent the Value union as a flat struct that internally keeps
|
// Instead, we represent the Value union as a flat struct that internally keeps
|
||||||
@@ -85,7 +85,7 @@ type Value value
|
|||||||
// ValueOf returns a Value initialized with the concrete value stored in v.
|
// ValueOf returns a Value initialized with the concrete value stored in v.
|
||||||
// This panics if the type does not match one of the allowed types in the
|
// This panics if the type does not match one of the allowed types in the
|
||||||
// Value union.
|
// Value union.
|
||||||
func ValueOf(v interface{}) Value {
|
func ValueOf(v any) Value {
|
||||||
switch v := v.(type) {
|
switch v := v.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return Value{}
|
return Value{}
|
||||||
@@ -192,10 +192,10 @@ func (v Value) IsValid() bool {
|
|||||||
return v.typ != nilType
|
return v.typ != nilType
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface returns v as an interface{}.
|
// Interface returns v as an any.
|
||||||
//
|
//
|
||||||
// Invariant: v == ValueOf(v).Interface()
|
// Invariant: v == ValueOf(v).Interface()
|
||||||
func (v Value) Interface() interface{} {
|
func (v Value) Interface() any {
|
||||||
switch v.typ {
|
switch v.typ {
|
||||||
case nilType:
|
case nilType:
|
||||||
return nil
|
return nil
|
||||||
@@ -406,8 +406,8 @@ func (k MapKey) IsValid() bool {
|
|||||||
return Value(k).IsValid()
|
return Value(k).IsValid()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface returns k as an interface{}.
|
// Interface returns k as an any.
|
||||||
func (k MapKey) Interface() interface{} {
|
func (k MapKey) Interface() any {
|
||||||
return Value(k).Interface()
|
return Value(k).Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -45,7 +45,7 @@ var (
|
|||||||
|
|
||||||
// typeOf returns a pointer to the Go type information.
|
// typeOf returns a pointer to the Go type information.
|
||||||
// The pointer is comparable and equal if and only if the types are identical.
|
// The pointer is comparable and equal if and only if the types are identical.
|
||||||
func typeOf(t interface{}) unsafe.Pointer {
|
func typeOf(t any) unsafe.Pointer {
|
||||||
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
|
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ func valueOfBytes(v []byte) Value {
|
|||||||
p := (*sliceHeader)(unsafe.Pointer(&v))
|
p := (*sliceHeader)(unsafe.Pointer(&v))
|
||||||
return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))}
|
return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))}
|
||||||
}
|
}
|
||||||
func valueOfIface(v interface{}) Value {
|
func valueOfIface(v any) Value {
|
||||||
p := (*ifaceHeader)(unsafe.Pointer(&v))
|
p := (*ifaceHeader)(unsafe.Pointer(&v))
|
||||||
return Value{typ: p.Type, ptr: p.Data}
|
return Value{typ: p.Type, ptr: p.Data}
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ func (v Value) getBytes() (x []byte) {
|
|||||||
*(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)}
|
*(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)}
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
func (v Value) getIface() (x interface{}) {
|
func (v Value) getIface() (x any) {
|
||||||
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
|
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
+4
-4
@@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
ifaceHeader struct {
|
ifaceHeader struct {
|
||||||
_ [0]interface{} // if interfaces have greater alignment than unsafe.Pointer, this will enforce it.
|
_ [0]any // if interfaces have greater alignment than unsafe.Pointer, this will enforce it.
|
||||||
Type unsafe.Pointer
|
Type unsafe.Pointer
|
||||||
Data unsafe.Pointer
|
Data unsafe.Pointer
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ var (
|
|||||||
|
|
||||||
// typeOf returns a pointer to the Go type information.
|
// typeOf returns a pointer to the Go type information.
|
||||||
// The pointer is comparable and equal if and only if the types are identical.
|
// The pointer is comparable and equal if and only if the types are identical.
|
||||||
func typeOf(t interface{}) unsafe.Pointer {
|
func typeOf(t any) unsafe.Pointer {
|
||||||
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
|
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ func valueOfString(v string) Value {
|
|||||||
func valueOfBytes(v []byte) Value {
|
func valueOfBytes(v []byte) Value {
|
||||||
return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))}
|
return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))}
|
||||||
}
|
}
|
||||||
func valueOfIface(v interface{}) Value {
|
func valueOfIface(v any) Value {
|
||||||
p := (*ifaceHeader)(unsafe.Pointer(&v))
|
p := (*ifaceHeader)(unsafe.Pointer(&v))
|
||||||
return Value{typ: p.Type, ptr: p.Data}
|
return Value{typ: p.Type, ptr: p.Data}
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ func (v Value) getString() string {
|
|||||||
func (v Value) getBytes() []byte {
|
func (v Value) getBytes() []byte {
|
||||||
return unsafe.Slice((*byte)(v.ptr), v.num)
|
return unsafe.Slice((*byte)(v.ptr), v.num)
|
||||||
}
|
}
|
||||||
func (v Value) getIface() (x interface{}) {
|
func (v Value) getIface() (x any) {
|
||||||
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
|
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
+7
-7
@@ -95,7 +95,7 @@ type Files struct {
|
|||||||
// multiple files. Only top-level declarations are registered.
|
// multiple files. Only top-level declarations are registered.
|
||||||
// Note that enum values are in the top-level since that are in the same
|
// Note that enum values are in the top-level since that are in the same
|
||||||
// scope as the parent enum.
|
// scope as the parent enum.
|
||||||
descsByName map[protoreflect.FullName]interface{}
|
descsByName map[protoreflect.FullName]any
|
||||||
filesByPath map[string][]protoreflect.FileDescriptor
|
filesByPath map[string][]protoreflect.FileDescriptor
|
||||||
numFiles int
|
numFiles int
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
|
|||||||
defer globalMutex.Unlock()
|
defer globalMutex.Unlock()
|
||||||
}
|
}
|
||||||
if r.descsByName == nil {
|
if r.descsByName == nil {
|
||||||
r.descsByName = map[protoreflect.FullName]interface{}{
|
r.descsByName = map[protoreflect.FullName]any{
|
||||||
"": &packageDescriptor{},
|
"": &packageDescriptor{},
|
||||||
}
|
}
|
||||||
r.filesByPath = make(map[string][]protoreflect.FileDescriptor)
|
r.filesByPath = make(map[string][]protoreflect.FileDescriptor)
|
||||||
@@ -485,7 +485,7 @@ type Types struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
typesByName map[protoreflect.FullName]interface{}
|
typesByName map[protoreflect.FullName]any
|
||||||
extensionsByMessage map[protoreflect.FullName]extensionsByNumber
|
extensionsByMessage map[protoreflect.FullName]extensionsByNumber
|
||||||
extensionsByNumber map[protoreflect.FieldNumber]protoreflect.ExtensionType
|
extensionsByNumber map[protoreflect.FieldNumber]protoreflect.ExtensionType
|
||||||
)
|
)
|
||||||
@@ -570,7 +570,7 @@ func (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error {
|
func (r *Types) register(kind string, desc protoreflect.Descriptor, typ any) error {
|
||||||
name := desc.FullName()
|
name := desc.FullName()
|
||||||
prev := r.typesByName[name]
|
prev := r.typesByName[name]
|
||||||
if prev != nil {
|
if prev != nil {
|
||||||
@@ -841,7 +841,7 @@ func (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func typeName(t interface{}) string {
|
func typeName(t any) string {
|
||||||
switch t.(type) {
|
switch t.(type) {
|
||||||
case protoreflect.EnumType:
|
case protoreflect.EnumType:
|
||||||
return "enum"
|
return "enum"
|
||||||
@@ -854,7 +854,7 @@ func typeName(t interface{}) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func amendErrorWithCaller(err error, prev, curr interface{}) error {
|
func amendErrorWithCaller(err error, prev, curr any) error {
|
||||||
prevPkg := goPackage(prev)
|
prevPkg := goPackage(prev)
|
||||||
currPkg := goPackage(curr)
|
currPkg := goPackage(curr)
|
||||||
if prevPkg == "" || currPkg == "" || prevPkg == currPkg {
|
if prevPkg == "" || currPkg == "" || prevPkg == currPkg {
|
||||||
@@ -863,7 +863,7 @@ func amendErrorWithCaller(err error, prev, curr interface{}) error {
|
|||||||
return errors.New("%s\n\tpreviously from: %q\n\tcurrently from: %q", err, prevPkg, currPkg)
|
return errors.New("%s\n\tpreviously from: %q\n\tcurrently from: %q", err, prevPkg, currPkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func goPackage(v interface{}) string {
|
func goPackage(v any) string {
|
||||||
switch d := v.(type) {
|
switch d := v.(type) {
|
||||||
case protoreflect.EnumType:
|
case protoreflect.EnumType:
|
||||||
v = d.Descriptor()
|
v = d.Descriptor()
|
||||||
|
|||||||
Vendored
+6
-6
@@ -72,7 +72,7 @@ github.com/go-playground/locales/currency
|
|||||||
# github.com/go-playground/universal-translator v0.18.1
|
# github.com/go-playground/universal-translator v0.18.1
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/go-playground/universal-translator
|
github.com/go-playground/universal-translator
|
||||||
# github.com/go-playground/validator/v10 v10.21.0
|
# github.com/go-playground/validator/v10 v10.22.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/go-playground/validator/v10
|
github.com/go-playground/validator/v10
|
||||||
# github.com/goccy/go-json v0.10.3
|
# github.com/goccy/go-json v0.10.3
|
||||||
@@ -98,7 +98,7 @@ github.com/holoplot/go-evdev
|
|||||||
# github.com/json-iterator/go v1.1.12
|
# github.com/json-iterator/go v1.1.12
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/json-iterator/go
|
github.com/json-iterator/go
|
||||||
# github.com/klauspost/cpuid/v2 v2.2.7
|
# github.com/klauspost/cpuid/v2 v2.2.8
|
||||||
## explicit; go 1.15
|
## explicit; go 1.15
|
||||||
github.com/klauspost/cpuid/v2
|
github.com/klauspost/cpuid/v2
|
||||||
# github.com/kr/pretty v0.3.1
|
# github.com/kr/pretty v0.3.1
|
||||||
@@ -153,7 +153,7 @@ github.com/pion/dtls/v2/pkg/protocol/alert
|
|||||||
github.com/pion/dtls/v2/pkg/protocol/extension
|
github.com/pion/dtls/v2/pkg/protocol/extension
|
||||||
github.com/pion/dtls/v2/pkg/protocol/handshake
|
github.com/pion/dtls/v2/pkg/protocol/handshake
|
||||||
github.com/pion/dtls/v2/pkg/protocol/recordlayer
|
github.com/pion/dtls/v2/pkg/protocol/recordlayer
|
||||||
# github.com/pion/ice/v2 v2.3.24
|
# github.com/pion/ice/v2 v2.3.25
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
github.com/pion/ice/v2
|
github.com/pion/ice/v2
|
||||||
github.com/pion/ice/v2/internal/atomic
|
github.com/pion/ice/v2/internal/atomic
|
||||||
@@ -216,7 +216,7 @@ github.com/pion/turn/v2/internal/client
|
|||||||
github.com/pion/turn/v2/internal/ipnet
|
github.com/pion/turn/v2/internal/ipnet
|
||||||
github.com/pion/turn/v2/internal/proto
|
github.com/pion/turn/v2/internal/proto
|
||||||
github.com/pion/turn/v2/internal/server
|
github.com/pion/turn/v2/internal/server
|
||||||
# github.com/pion/webrtc/v3 v3.2.40
|
# github.com/pion/webrtc/v3 v3.2.42
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/pion/webrtc/v3
|
github.com/pion/webrtc/v3
|
||||||
github.com/pion/webrtc/v3/internal/fmtp
|
github.com/pion/webrtc/v3/internal/fmtp
|
||||||
@@ -334,8 +334,8 @@ golang.org/x/tools/internal/stdlib
|
|||||||
golang.org/x/tools/internal/tokeninternal
|
golang.org/x/tools/internal/tokeninternal
|
||||||
golang.org/x/tools/internal/typesinternal
|
golang.org/x/tools/internal/typesinternal
|
||||||
golang.org/x/tools/internal/versions
|
golang.org/x/tools/internal/versions
|
||||||
# google.golang.org/protobuf v1.34.1
|
# google.golang.org/protobuf v1.34.2
|
||||||
## explicit; go 1.17
|
## explicit; go 1.20
|
||||||
google.golang.org/protobuf/encoding/protowire
|
google.golang.org/protobuf/encoding/protowire
|
||||||
google.golang.org/protobuf/internal/detrand
|
google.golang.org/protobuf/internal/detrand
|
||||||
google.golang.org/protobuf/internal/encoding/messageset
|
google.golang.org/protobuf/internal/encoding/messageset
|
||||||
|
|||||||
Reference in new issue
Block a user