forked from TrueCloudLab/restic
parent
aa7043151a
commit
b9f0f031b6
672 changed files with 116946 additions and 13086 deletions
64
go.mod
64
go.mod
|
@ -2,54 +2,50 @@ module github.com/restic/restic
|
||||||
|
|
||||||
require (
|
require (
|
||||||
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669
|
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669
|
||||||
cloud.google.com/go v0.27.0 // indirect
|
cloud.google.com/go v0.36.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go v20.1.0+incompatible
|
contrib.go.opencensus.io/exporter/ocagent v0.4.3 // indirect
|
||||||
github.com/Azure/go-autorest v10.15.3+incompatible // indirect
|
github.com/Azure/azure-sdk-for-go v25.1.0+incompatible
|
||||||
github.com/cenkalti/backoff v2.0.0+incompatible
|
github.com/Azure/go-autorest v11.4.0+incompatible // indirect
|
||||||
|
github.com/cenkalti/backoff v2.1.1+incompatible
|
||||||
github.com/cpuguy83/go-md2man v1.0.8 // indirect
|
github.com/cpuguy83/go-md2man v1.0.8 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
|
||||||
github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2 // indirect
|
github.com/dnaeon/go-vcr v1.0.1 // indirect
|
||||||
github.com/elithrar/simple-scrypt v1.3.0
|
github.com/elithrar/simple-scrypt v1.3.0
|
||||||
github.com/go-ini/ini v1.38.2 // indirect
|
github.com/go-ini/ini v1.41.0 // indirect
|
||||||
github.com/golang/protobuf v1.2.0 // indirect
|
|
||||||
github.com/google/go-cmp v0.2.0
|
github.com/google/go-cmp v0.2.0
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c // indirect
|
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.7.0 // indirect
|
||||||
github.com/hashicorp/golang-lru v0.5.0
|
github.com/hashicorp/golang-lru v0.5.0
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||||
github.com/jtolds/gls v4.2.1+incompatible // indirect
|
github.com/jtolds/gls v4.2.1+incompatible // indirect
|
||||||
github.com/juju/ratelimit v1.0.1
|
github.com/juju/ratelimit v1.0.1
|
||||||
github.com/kr/fs v0.1.0 // indirect
|
github.com/kr/fs v0.1.0 // indirect
|
||||||
github.com/kr/pretty v0.1.0 // indirect
|
github.com/kurin/blazer v0.5.3
|
||||||
github.com/kurin/blazer v0.5.1
|
|
||||||
github.com/marstr/guid v1.1.0 // indirect
|
github.com/marstr/guid v1.1.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.4
|
github.com/mattn/go-isatty v0.0.4
|
||||||
github.com/minio/minio-go v6.0.7+incompatible
|
github.com/minio/minio-go v6.0.14+incompatible
|
||||||
github.com/mitchellh/go-homedir v1.0.0 // indirect
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||||
github.com/ncw/swift v1.0.41
|
github.com/ncw/swift v1.0.44
|
||||||
github.com/pkg/errors v0.8.0
|
github.com/pkg/errors v0.8.1
|
||||||
github.com/pkg/profile v1.2.1
|
github.com/pkg/profile v1.2.1
|
||||||
github.com/pkg/sftp v1.8.2
|
github.com/pkg/sftp v1.10.0
|
||||||
github.com/pkg/xattr v0.3.1
|
github.com/pkg/xattr v0.4.0
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
||||||
github.com/restic/chunker v0.2.0
|
github.com/restic/chunker v0.2.0
|
||||||
github.com/russross/blackfriday v1.5.1 // indirect
|
|
||||||
github.com/satori/go.uuid v1.2.0 // indirect
|
github.com/satori/go.uuid v1.2.0 // indirect
|
||||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect
|
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
|
||||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
|
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
|
||||||
github.com/spf13/cobra v0.0.3
|
github.com/spf13/cobra v0.0.3
|
||||||
github.com/spf13/pflag v1.0.2
|
github.com/spf13/pflag v1.0.3
|
||||||
github.com/stretchr/testify v1.2.2 // indirect
|
github.com/stretchr/testify v1.3.0 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
|
go.opencensus.io v0.19.0 // indirect
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
|
golang.org/x/crypto v0.0.0-20190208162236-193df9c0f06f
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
|
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
|
golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1
|
||||||
golang.org/x/sys v0.0.0-20180907202204-917fdcba135d
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
|
||||||
golang.org/x/text v0.3.0
|
golang.org/x/sys v0.0.0-20190209173611-3b5209105503
|
||||||
google.golang.org/api v0.0.0-20180907210053-b609d5e6b7ab
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
|
||||||
google.golang.org/appengine v1.1.0 // indirect
|
google.golang.org/api v0.1.0
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
google.golang.org/grpc v1.18.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.38.2 // indirect
|
gopkg.in/ini.v1 v1.41.0 // indirect
|
||||||
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
|
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
|
||||||
gopkg.in/yaml.v2 v2.2.1 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
248
go.sum
248
go.sum
|
@ -1,108 +1,266 @@
|
||||||
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669 h1:FNCRpXiquG1aoyqcIWVFmpTSKVcx2bQD38uZZeGtdlw=
|
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669 h1:FNCRpXiquG1aoyqcIWVFmpTSKVcx2bQD38uZZeGtdlw=
|
||||||
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
|
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
|
||||||
cloud.google.com/go v0.27.0 h1:Xa8ZWro6QYKOwDKtxfKsiE0ea2jD39nx32RxtF5RjYE=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
cloud.google.com/go v0.27.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
github.com/Azure/azure-sdk-for-go v20.1.0+incompatible h1:b8OWFQuH5MPi2LYyAR2Ga+7KVH9ipwiSSSMga04/Urc=
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
github.com/Azure/azure-sdk-for-go v20.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
cloud.google.com/go v0.36.0 h1:+aCSj7tOo2LODWVEuZDZeGCckdt6MlSF+X/rB3wUiS8=
|
||||||
github.com/Azure/go-autorest v10.15.3+incompatible h1:nhKI/bvazIs3C3TFGoSqKY6hZ8f5od5mb5/UcS6HVIY=
|
cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40=
|
||||||
github.com/Azure/go-autorest v10.15.3+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
contrib.go.opencensus.io/exporter/ocagent v0.4.3 h1:QjNm697iO7CZ09IxxSiCUzOhALENIsLsixdPwjV1yGs=
|
||||||
github.com/cenkalti/backoff v2.0.0+incompatible h1:5IIPUHhlnUZbcHQsQou5k1Tn58nJkeJL9U+ig5CHJbY=
|
contrib.go.opencensus.io/exporter/ocagent v0.4.3/go.mod h1:YuG83h+XWwqWjvCqn7vK4KSyLKhThY3+gNGQ37iS2V0=
|
||||||
github.com/cenkalti/backoff v2.0.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU=
|
||||||
|
dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
|
||||||
|
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
|
||||||
|
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
|
||||||
|
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
|
||||||
|
git.apache.org/thrift.git v0.0.0-20181218151757-9b75e4fe745a/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
|
||||||
|
github.com/Azure/azure-sdk-for-go v25.1.0+incompatible h1:bA8mqsHUc9RbzHG64A6r7KnpvLFHJdxrpI75FrFln2M=
|
||||||
|
github.com/Azure/azure-sdk-for-go v25.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||||
|
github.com/Azure/go-autorest v11.4.0+incompatible h1:z3Yr6KYqs0nhSNwqGXEBpWK977hxVqsLv2n9PVYcixY=
|
||||||
|
github.com/Azure/go-autorest v11.4.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||||
|
github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
|
||||||
|
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8 h1:gUqsFVdUKoRHNg8fkFd8gB5OOEa/g5EwlAHznb4zjbI=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||||
github.com/cpuguy83/go-md2man v1.0.8 h1:DwoNytLphI8hzS2Af4D0dfaEaiSq2bN05mEm4R6vf8M=
|
github.com/cpuguy83/go-md2man v1.0.8 h1:DwoNytLphI8hzS2Af4D0dfaEaiSq2bN05mEm4R6vf8M=
|
||||||
github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY=
|
github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2 h1:G9/PqfhOrt8JXnw0DGTfVoOkKHDhOlEZqhE/cu+NvQM=
|
github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY=
|
||||||
github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
||||||
|
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||||
github.com/elithrar/simple-scrypt v1.3.0 h1:KIlOlxdoQf9JWKl5lMAJ28SY2URB0XTRDn2TckyzAZg=
|
github.com/elithrar/simple-scrypt v1.3.0 h1:KIlOlxdoQf9JWKl5lMAJ28SY2URB0XTRDn2TckyzAZg=
|
||||||
github.com/elithrar/simple-scrypt v1.3.0/go.mod h1:U2XQRI95XHY0St410VE3UjT7vuKb1qPwrl/EJwEqnZo=
|
github.com/elithrar/simple-scrypt v1.3.0/go.mod h1:U2XQRI95XHY0St410VE3UjT7vuKb1qPwrl/EJwEqnZo=
|
||||||
github.com/go-ini/ini v1.38.2 h1:6Hl/z3p3iFkA0dlDfzYxuFuUGD+kaweypF6btsR2/Q4=
|
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||||
github.com/go-ini/ini v1.38.2/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||||
|
github.com/go-ini/ini v1.41.0 h1:526aoxDtxRHFQKMZfcX2OG9oOI8TJ5yPLM0Mkno/uTY=
|
||||||
|
github.com/go-ini/ini v1.41.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||||
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw=
|
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
|
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||||
|
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||||
|
github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.6.2/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.7.0 h1:tPFY/SM+d656aSgLWO2Eckc3ExwpwwybwdN5Ph20h1A=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.7.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||||
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
|
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
|
||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
|
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||||
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
|
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
|
||||||
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/juju/ratelimit v1.0.1 h1:+7AIFJVQ0EQgq/K9+0Krm7m530Du7tIz0METWzN0RgY=
|
github.com/juju/ratelimit v1.0.1 h1:+7AIFJVQ0EQgq/K9+0Krm7m530Du7tIz0METWzN0RgY=
|
||||||
github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
|
github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
|
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
|
||||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
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/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kurin/blazer v0.5.1 h1:mBc4i1uhHJEqU0KvzOgpMHhkwf+EcXvxjWEUS7HG+eY=
|
github.com/kurin/blazer v0.5.3 h1:SAgYv0TKU0kN/ETfO5ExjNAPyMt2FocO2s/UlCHfjAk=
|
||||||
github.com/kurin/blazer v0.5.1/go.mod h1:4FCXMUWo9DllR2Do4TtBd377ezyAJ51vB5uTBjt0pGU=
|
github.com/kurin/blazer v0.5.3/go.mod h1:4FCXMUWo9DllR2Do4TtBd377ezyAJ51vB5uTBjt0pGU=
|
||||||
github.com/marstr/guid v1.1.0 h1:/M4H/1G4avsieL6BbUwCOBzulmoeKVP5ux/3mQNnbyI=
|
github.com/marstr/guid v1.1.0 h1:/M4H/1G4avsieL6BbUwCOBzulmoeKVP5ux/3mQNnbyI=
|
||||||
github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
|
github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
|
||||||
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
|
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
|
||||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
github.com/minio/minio-go v6.0.7+incompatible h1:nWABqotkiT/3aLgFnG30doQiwFkDMM9xnGGQnS+Ao6M=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
github.com/minio/minio-go v6.0.7+incompatible/go.mod h1:7guKYtitv8dktvNUGrhzmNlA5wrAABTQXCoesZdFQO8=
|
github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
|
||||||
github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
|
github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o=
|
||||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
github.com/minio/minio-go v6.0.14+incompatible/go.mod h1:7guKYtitv8dktvNUGrhzmNlA5wrAABTQXCoesZdFQO8=
|
||||||
github.com/ncw/swift v1.0.41 h1:kfoTVQKt1A4n0m1Q3YWku9OoXfpo06biqVfi73yseBs=
|
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||||
github.com/ncw/swift v1.0.41/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
github.com/ncw/swift v1.0.44 h1:EKvOTvUxElbpDWqxsyVaVGvc2IfuOqQnRmjnR2AGhQ4=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/ncw/swift v1.0.44/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
||||||
|
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
|
||||||
|
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
|
||||||
|
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||||
|
github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||||
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/profile v1.2.1 h1:F++O52m40owAmADcojzM+9gyjmMOY/T4oYJkgFDH8RE=
|
github.com/pkg/profile v1.2.1 h1:F++O52m40owAmADcojzM+9gyjmMOY/T4oYJkgFDH8RE=
|
||||||
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
||||||
github.com/pkg/sftp v1.8.2 h1:3upwlsK5/USEeM5gzIe9eWdzU4sV+kG3gKKg3RLBuWE=
|
github.com/pkg/sftp v1.10.0 h1:DGA1KlA9esU6WcicH+P8PxFZOl15O6GYtab1cIJdOlE=
|
||||||
github.com/pkg/sftp v1.8.2/go.mod h1:NxmoDg/QLVWluQDUYG7XBZTLUpKeFa8e3aMf1BfjyHk=
|
github.com/pkg/sftp v1.10.0/go.mod h1:NxmoDg/QLVWluQDUYG7XBZTLUpKeFa8e3aMf1BfjyHk=
|
||||||
github.com/pkg/xattr v0.3.1 h1:6ceg5jxT3cH4lM5n8S2PmiNeOv61MK08yvvYJwyrPH0=
|
github.com/pkg/xattr v0.4.0 h1:OacIpDCc4H+4b/bWpYBLOT5gXk7G/jwx5O1D8x8Zewo=
|
||||||
github.com/pkg/xattr v0.3.1/go.mod h1:CBdxFOf0VLbaj6HKuP2ITOVV7NY6ycPKgIgnSx2ZNVs=
|
github.com/pkg/xattr v0.4.0/go.mod h1:W2cGD0TBEus7MkUgv0tNZ9JutLtVO3cXu+IBRuHqnFs=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
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/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
|
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
|
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
|
github.com/prometheus/common v0.0.0-20181218105931-67670fe90761/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
github.com/restic/chunker v0.2.0 h1:GjvmvFuv2mx0iekZs+iAlrioo2UtgsGSSplvoXaVHDU=
|
github.com/restic/chunker v0.2.0 h1:GjvmvFuv2mx0iekZs+iAlrioo2UtgsGSSplvoXaVHDU=
|
||||||
github.com/restic/chunker v0.2.0/go.mod h1:VdjruEj+7BU1ZZTW8Qqi1exxRx2Omf2JH0NsUEkQ29s=
|
github.com/restic/chunker v0.2.0/go.mod h1:VdjruEj+7BU1ZZTW8Qqi1exxRx2Omf2JH0NsUEkQ29s=
|
||||||
github.com/russross/blackfriday v1.5.1 h1:B8ZN6pD4PVofmlDCDUdELeYrbsVIDM/bpjW3v3zgcRc=
|
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
|
||||||
github.com/russross/blackfriday v1.5.1/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=
|
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo=
|
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0=
|
||||||
|
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
|
||||||
|
github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=
|
||||||
|
github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
|
||||||
|
github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI=
|
||||||
|
github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU=
|
||||||
|
github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag=
|
||||||
|
github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg=
|
||||||
|
github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw=
|
||||||
|
github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y=
|
||||||
|
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
||||||
|
github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q=
|
||||||
|
github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ=
|
||||||
|
github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I=
|
||||||
|
github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0=
|
||||||
|
github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ=
|
||||||
|
github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
|
||||||
|
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w=
|
||||||
|
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||||
|
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE=
|
||||||
|
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
|
||||||
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
||||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||||
github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
|
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
||||||
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||||
|
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||||
|
go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||||
|
go.opencensus.io v0.19.0 h1:+jrnNy8MR4GZXvwF9PEuSyHxA4NaTf6601oNRwCSXq0=
|
||||||
|
go.opencensus.io v0.19.0/go.mod h1:AYeH0+ZxYyghG8diqaaIq/9P3VgCCt5GF2ldCY4dkFg=
|
||||||
|
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
||||||
|
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
|
||||||
|
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190208162236-193df9c0f06f h1:ETU2VEl7TnT5bl7IvuKEzTDpplg5wzGYsOCAPhdoEIg=
|
||||||
|
golang.org/x/crypto v0.0.0-20190208162236-193df9c0f06f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181217023233-e147a9138326/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 h1:bfLnR+k0tq5Lqt6dflRLcZiz6UaXCMt3vhYJ1l4FQ80=
|
||||||
|
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1 h1:VeAkjQVzKLmu+JnFcK96TPbkuaTIqwGGAzQ9hgwPjVg=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180525142821-c11f84a56e43/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180907202204-917fdcba135d h1:kWn1hlsqeUrk6JsLJO0ZFyz9bMg8u85voZlIuc68ZU4=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
|
||||||
golang.org/x/sys v0.0.0-20180907202204-917fdcba135d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181021155630-eda9bb28ed51/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190209173611-3b5209105503 h1:5SvYFrOM3W8Mexn9/oA44Ji7vhXAZQ9hiP+1Q/DMrWg=
|
||||||
|
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
google.golang.org/api v0.0.0-20180907210053-b609d5e6b7ab h1:qNpJa8m9WofZ7RLj+7o15Ppapwm30+RweyIDSNpw8ps=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=
|
||||||
google.golang.org/api v0.0.0-20180907210053-b609d5e6b7ab/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
|
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
|
google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
|
google.golang.org/api v0.1.0 h1:K6z2u68e86TPdSdefXdzvXgR1zEMa+459vBSfWYAZkI=
|
||||||
|
google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
|
||||||
google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=
|
google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg=
|
||||||
|
google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg=
|
||||||
|
google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922 h1:mBVYJnbrXLA/ZCBTCe7PtEgAUP+1bg92qTaFoPHdz+8=
|
||||||
|
google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4=
|
||||||
|
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||||
|
google.golang.org/grpc v1.15.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
|
||||||
|
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
|
||||||
|
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||||
|
google.golang.org/grpc v1.18.0 h1:IZl7mfBGfbhYx2p2rKRtYgDFw6SBz+kclmxYrCksPPA=
|
||||||
|
google.golang.org/grpc v1.18.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
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-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/ini.v1 v1.38.2 h1:dGcbywv4RufeGeiMycPT/plKB5FtmLKLnWKwBiLhUA4=
|
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||||
gopkg.in/ini.v1 v1.38.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.41.0 h1:Ka3ViY6gNYSKiVy71zXBEqKplnV35ImDLVG+8uoIklE=
|
||||||
|
gopkg.in/ini.v1 v1.41.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs=
|
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs=
|
||||||
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk=
|
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk=
|
||||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
|
||||||
|
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
|
||||||
|
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
|
||||||
|
|
30
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
30
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
|
@ -20,6 +20,7 @@
|
||||||
package metadata // import "cloud.google.com/go/compute/metadata"
|
package metadata // import "cloud.google.com/go/compute/metadata"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -31,9 +32,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"golang.org/x/net/context/ctxhttp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -139,11 +137,11 @@ func testOnGCE() bool {
|
||||||
resc := make(chan bool, 2)
|
resc := make(chan bool, 2)
|
||||||
|
|
||||||
// Try two strategies in parallel.
|
// Try two strategies in parallel.
|
||||||
// See https://github.com/GoogleCloudPlatform/google-cloud-go/issues/194
|
// See https://github.com/googleapis/google-cloud-go/issues/194
|
||||||
go func() {
|
go func() {
|
||||||
req, _ := http.NewRequest("GET", "http://"+metadataIP, nil)
|
req, _ := http.NewRequest("GET", "http://"+metadataIP, nil)
|
||||||
req.Header.Set("User-Agent", userAgent)
|
req.Header.Set("User-Agent", userAgent)
|
||||||
res, err := ctxhttp.Do(ctx, defaultClient.hc, req)
|
res, err := defaultClient.hc.Do(req.WithContext(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resc <- false
|
resc <- false
|
||||||
return
|
return
|
||||||
|
@ -302,8 +300,8 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||||
// being stable anyway.
|
// being stable anyway.
|
||||||
host = metadataIP
|
host = metadataIP
|
||||||
}
|
}
|
||||||
url := "http://" + host + "/computeMetadata/v1/" + suffix
|
u := "http://" + host + "/computeMetadata/v1/" + suffix
|
||||||
req, _ := http.NewRequest("GET", url, nil)
|
req, _ := http.NewRequest("GET", u, nil)
|
||||||
req.Header.Set("Metadata-Flavor", "Google")
|
req.Header.Set("Metadata-Flavor", "Google")
|
||||||
req.Header.Set("User-Agent", userAgent)
|
req.Header.Set("User-Agent", userAgent)
|
||||||
res, err := c.hc.Do(req)
|
res, err := c.hc.Do(req)
|
||||||
|
@ -314,13 +312,13 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||||
if res.StatusCode == http.StatusNotFound {
|
if res.StatusCode == http.StatusNotFound {
|
||||||
return "", "", NotDefinedError(suffix)
|
return "", "", NotDefinedError(suffix)
|
||||||
}
|
}
|
||||||
if res.StatusCode != 200 {
|
|
||||||
return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url)
|
|
||||||
}
|
|
||||||
all, err := ioutil.ReadAll(res.Body)
|
all, err := ioutil.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
|
if res.StatusCode != 200 {
|
||||||
|
return "", "", &Error{Code: res.StatusCode, Message: string(all)}
|
||||||
|
}
|
||||||
return string(all), res.Header.Get("Etag"), nil
|
return string(all), res.Header.Get("Etag"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,3 +499,15 @@ func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) erro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error contains an error response from the server.
|
||||||
|
type Error struct {
|
||||||
|
// Code is the HTTP response status code.
|
||||||
|
Code int
|
||||||
|
// Message is the server response message.
|
||||||
|
Message string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Error) Error() string {
|
||||||
|
return fmt.Sprintf("compute: Received %d `%s`", e.Code, e.Message)
|
||||||
|
}
|
||||||
|
|
17
vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml
generated
vendored
Normal file
17
vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
language: go
|
||||||
|
|
||||||
|
go:
|
||||||
|
- 1.11.x
|
||||||
|
|
||||||
|
go_import_path: contrib.go.opencensus.io/exporter/ocagent
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) # All the .go files, excluding vendor/ if any
|
||||||
|
- PKGS=$(go list ./... | grep -v /vendor/) # All the import paths, excluding vendor/ if any
|
||||||
|
|
||||||
|
script:
|
||||||
|
- go build ./... # Ensure dependency updates don't break build
|
||||||
|
- if [ -n "$(gofmt -s -l $GO_FILES)" ]; then echo "gofmt the following files:"; gofmt -s -l $GO_FILES; exit 1; fi
|
||||||
|
- go vet ./...
|
||||||
|
- go test -v -race $PKGS # Run all the tests with the race detector enabled
|
||||||
|
- 'if [[ $TRAVIS_GO_VERSION = 1.8* ]]; then ! golint ./... | grep -vE "(_mock|_string|\.pb)\.go:"; fi'
|
24
vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md
generated
vendored
Normal file
24
vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# How to contribute
|
||||||
|
|
||||||
|
We'd love to accept your patches and contributions to this project. There are
|
||||||
|
just a few small guidelines you need to follow.
|
||||||
|
|
||||||
|
## Contributor License Agreement
|
||||||
|
|
||||||
|
Contributions to this project must be accompanied by a Contributor License
|
||||||
|
Agreement. You (or your employer) retain the copyright to your contribution,
|
||||||
|
this simply gives us permission to use and redistribute your contributions as
|
||||||
|
part of the project. Head over to <https://cla.developers.google.com/> to see
|
||||||
|
your current agreements on file or to sign a new one.
|
||||||
|
|
||||||
|
You generally only need to submit a CLA once, so if you've already submitted one
|
||||||
|
(even if it was for a different project), you probably don't need to do it
|
||||||
|
again.
|
||||||
|
|
||||||
|
## Code reviews
|
||||||
|
|
||||||
|
All submissions, including submissions by project members, require review. We
|
||||||
|
use GitHub pull requests for this purpose. Consult [GitHub Help] for more
|
||||||
|
information on using pull requests.
|
||||||
|
|
||||||
|
[GitHub Help]: https://help.github.com/articles/about-pull-requests/
|
201
vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE
generated
vendored
Normal file
201
vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
61
vendor/contrib.go.opencensus.io/exporter/ocagent/README.md
generated
vendored
Normal file
61
vendor/contrib.go.opencensus.io/exporter/ocagent/README.md
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# OpenCensus Agent Go Exporter
|
||||||
|
|
||||||
|
[![Build Status][travis-image]][travis-url] [![GoDoc][godoc-image]][godoc-url]
|
||||||
|
|
||||||
|
|
||||||
|
This repository contains the Go implementation of the OpenCensus Agent (OC-Agent) Exporter.
|
||||||
|
OC-Agent is a deamon process running in a VM that can retrieve spans/stats/metrics from
|
||||||
|
OpenCensus Library, export them to other backends and possibly push configurations back to
|
||||||
|
Library. See more details on [OC-Agent Readme][OCAgentReadme].
|
||||||
|
|
||||||
|
Note: This is an experimental repository and is likely to get backwards-incompatible changes.
|
||||||
|
Ultimately we may want to move the OC-Agent Go Exporter to [OpenCensus Go core library][OpenCensusGo].
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go get -u contrib.go.opencensus.io/exporter/ocagent
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"contrib.go.opencensus.io/exporter/ocagent"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Example() {
|
||||||
|
exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithServiceName("your-service-name"))
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Failed to create the agent exporter: %v", err)
|
||||||
|
}
|
||||||
|
defer exp.Stop()
|
||||||
|
|
||||||
|
// Now register it as a trace exporter.
|
||||||
|
trace.RegisterExporter(exp)
|
||||||
|
|
||||||
|
// Then use the OpenCensus tracing library, like we normally would.
|
||||||
|
ctx, span := trace.StartSpan(context.Background(), "AgentExporter-Example")
|
||||||
|
defer span.End()
|
||||||
|
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
_, iSpan := trace.StartSpan(ctx, fmt.Sprintf("Sample-%d", i))
|
||||||
|
<-time.After(6 * time.Millisecond)
|
||||||
|
iSpan.End()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
[OCAgentReadme]: https://github.com/census-instrumentation/opencensus-proto/tree/master/opencensus/proto/agent#opencensus-agent-proto
|
||||||
|
[OpenCensusGo]: https://github.com/census-instrumentation/opencensus-go
|
||||||
|
[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent?status.svg
|
||||||
|
[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent
|
||||||
|
[travis-image]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent.svg?branch=master
|
||||||
|
[travis-url]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent
|
||||||
|
|
38
vendor/contrib.go.opencensus.io/exporter/ocagent/common.go
generated
vendored
Normal file
38
vendor/contrib.go.opencensus.io/exporter/ocagent/common.go
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var randSrc = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
|
||||||
|
// retries function fn upto n times, if fn returns an error lest it returns nil early.
|
||||||
|
// It applies exponential backoff in units of (1<<n) + jitter microsends.
|
||||||
|
func nTriesWithExponentialBackoff(nTries int64, timeBaseUnit time.Duration, fn func() error) (err error) {
|
||||||
|
for i := int64(0); i < nTries; i++ {
|
||||||
|
err = fn()
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
// Backoff for a time period with a pseudo-random jitter
|
||||||
|
jitter := time.Duration(randSrc.Float64()*100) * time.Microsecond
|
||||||
|
ts := jitter + ((1 << uint64(i)) * timeBaseUnit)
|
||||||
|
<-time.After(ts)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
94
vendor/contrib.go.opencensus.io/exporter/ocagent/connection.go
generated
vendored
Normal file
94
vendor/contrib.go.opencensus.io/exporter/ocagent/connection.go
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"sync/atomic"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
sDisconnected int32 = 5 + iota
|
||||||
|
sConnected
|
||||||
|
)
|
||||||
|
|
||||||
|
func (ae *Exporter) setStateDisconnected() {
|
||||||
|
atomic.StoreInt32(&ae.connectionState, sDisconnected)
|
||||||
|
ae.disconnectedCh <- true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) setStateConnected() {
|
||||||
|
atomic.StoreInt32(&ae.connectionState, sConnected)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) connected() bool {
|
||||||
|
return atomic.LoadInt32(&ae.connectionState) == sConnected
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultConnReattemptPeriod = 10 * time.Second
|
||||||
|
|
||||||
|
func (ae *Exporter) indefiniteBackgroundConnection() error {
|
||||||
|
defer func() {
|
||||||
|
ae.backgroundConnectionDoneCh <- true
|
||||||
|
}()
|
||||||
|
|
||||||
|
connReattemptPeriod := ae.reconnectionPeriod
|
||||||
|
if connReattemptPeriod <= 0 {
|
||||||
|
connReattemptPeriod = defaultConnReattemptPeriod
|
||||||
|
}
|
||||||
|
|
||||||
|
// No strong seeding required, nano time can
|
||||||
|
// already help with pseudo uniqueness.
|
||||||
|
rng := rand.New(rand.NewSource(time.Now().UnixNano() + rand.Int63n(1024)))
|
||||||
|
|
||||||
|
// maxJitter: 1 + (70% of the connectionReattemptPeriod)
|
||||||
|
maxJitter := int64(1 + 0.7*float64(connReattemptPeriod))
|
||||||
|
|
||||||
|
for {
|
||||||
|
// Otherwise these will be the normal scenarios to enable
|
||||||
|
// reconnections if we trip out.
|
||||||
|
// 1. If we've stopped, return entirely
|
||||||
|
// 2. Otherwise block until we are disconnected, and
|
||||||
|
// then retry connecting
|
||||||
|
select {
|
||||||
|
case <-ae.stopCh:
|
||||||
|
return errStopped
|
||||||
|
|
||||||
|
case <-ae.disconnectedCh:
|
||||||
|
// Normal scenario that we'll wait for
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ae.connect(); err == nil {
|
||||||
|
ae.setStateConnected()
|
||||||
|
} else {
|
||||||
|
ae.setStateDisconnected()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply some jitter to avoid lockstep retrials of other
|
||||||
|
// agent-exporters. Lockstep retrials could result in an
|
||||||
|
// innocent DDOS, by clogging the machine's resources and network.
|
||||||
|
jitter := time.Duration(rng.Int63n(maxJitter))
|
||||||
|
<-time.After(connReattemptPeriod + jitter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) connect() error {
|
||||||
|
cc, err := ae.dialToAgent()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return ae.enableConnectionStreams(cc)
|
||||||
|
}
|
9
vendor/contrib.go.opencensus.io/exporter/ocagent/go.mod
generated
vendored
Normal file
9
vendor/contrib.go.opencensus.io/exporter/ocagent/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module contrib.go.opencensus.io/exporter/ocagent
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8 // this is to match the version used in census-instrumentation/opencensus-service
|
||||||
|
github.com/golang/protobuf v1.2.0
|
||||||
|
go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b
|
||||||
|
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf
|
||||||
|
google.golang.org/grpc v1.15.0
|
||||||
|
)
|
55
vendor/contrib.go.opencensus.io/exporter/ocagent/go.sum
generated
vendored
Normal file
55
vendor/contrib.go.opencensus.io/exporter/ocagent/go.sum
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.0.1 h1:4v5I+ax5jCmwTYVaWQacX8ZSxvUZemBX4UwBGSkDeoA=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.0.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.0.2-0.20180913191712-f303ae3f8d6a h1:t88pXOTS5K+pjfuhTOcul6sdC4khgqB8ukyfbe62Zxo=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.0.2-0.20180913191712-f303ae3f8d6a/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.1.0 h1:VwZ9smxzX8u14/125wHIX7ARV+YhR+L4JADswwxWK0Y=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.1.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||||
|
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
go.opencensus.io v0.17.0 h1:2Cu88MYg+1LU+WVD+NWwYhyP0kKgRlN9QjWGaX0jKTE=
|
||||||
|
go.opencensus.io v0.17.0/go.mod h1:mp1VrMQxhlqqDpKvH4UcQUa4YwlzNmymAjPrDdfxNpI=
|
||||||
|
go.opencensus.io v0.18.0 h1:Mk5rgZcggtbvtAun5aJzAtjKKN/t0R3jJPlWILlv938=
|
||||||
|
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||||
|
go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b h1:6ayHMBPtdP3jNuk+Sfhso+PTB7ZJQ5E1FBo403m2H8w=
|
||||||
|
go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||||
|
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf h1:rjxqQmxjyqerRKEj+tZW+MCm4LgpFXu18bsEoCMgDsk=
|
||||||
|
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw=
|
||||||
|
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||||
|
google.golang.org/grpc v1.15.0 h1:Az/KuahOM4NAidTEuJCv/RonAA7rYsTPkqXVjr+8OOw=
|
||||||
|
google.golang.org/grpc v1.15.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
46
vendor/contrib.go.opencensus.io/exporter/ocagent/nodeinfo.go
generated
vendored
Normal file
46
vendor/contrib.go.opencensus.io/exporter/ocagent/nodeinfo.go
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
commonpb "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
|
||||||
|
"go.opencensus.io"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NodeWithStartTime creates a node using nodeName and derives:
|
||||||
|
// Hostname from the environment
|
||||||
|
// Pid from the current process
|
||||||
|
// StartTimestamp from the start time of this process
|
||||||
|
// Language and library information.
|
||||||
|
func NodeWithStartTime(nodeName string) *commonpb.Node {
|
||||||
|
return &commonpb.Node{
|
||||||
|
Identifier: &commonpb.ProcessIdentifier{
|
||||||
|
HostName: os.Getenv("HOSTNAME"),
|
||||||
|
Pid: uint32(os.Getpid()),
|
||||||
|
StartTimestamp: timeToTimestamp(startTime),
|
||||||
|
},
|
||||||
|
LibraryInfo: &commonpb.LibraryInfo{
|
||||||
|
Language: commonpb.LibraryInfo_GO_LANG,
|
||||||
|
ExporterVersion: Version,
|
||||||
|
CoreLibraryVersion: opencensus.Version(),
|
||||||
|
},
|
||||||
|
ServiceInfo: &commonpb.ServiceInfo{
|
||||||
|
Name: nodeName,
|
||||||
|
},
|
||||||
|
Attributes: make(map[string]string),
|
||||||
|
}
|
||||||
|
}
|
478
vendor/contrib.go.opencensus.io/exporter/ocagent/ocagent.go
generated
vendored
Normal file
478
vendor/contrib.go.opencensus.io/exporter/ocagent/ocagent.go
generated
vendored
Normal file
|
@ -0,0 +1,478 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"google.golang.org/api/support/bundler"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
|
"go.opencensus.io/resource"
|
||||||
|
"go.opencensus.io/stats/view"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
|
|
||||||
|
commonpb "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
|
||||||
|
agentmetricspb "github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1"
|
||||||
|
agenttracepb "github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1"
|
||||||
|
metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1"
|
||||||
|
resourcepb "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1"
|
||||||
|
tracepb "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
var startupMu sync.Mutex
|
||||||
|
var startTime time.Time
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
startupMu.Lock()
|
||||||
|
startTime = time.Now()
|
||||||
|
startupMu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ trace.Exporter = (*Exporter)(nil)
|
||||||
|
var _ view.Exporter = (*Exporter)(nil)
|
||||||
|
|
||||||
|
type Exporter struct {
|
||||||
|
connectionState int32
|
||||||
|
|
||||||
|
// mu protects the non-atomic and non-channel variables
|
||||||
|
mu sync.RWMutex
|
||||||
|
// senderMu protects the concurrent unsafe traceExporter client
|
||||||
|
senderMu sync.RWMutex
|
||||||
|
started bool
|
||||||
|
stopped bool
|
||||||
|
agentAddress string
|
||||||
|
serviceName string
|
||||||
|
canDialInsecure bool
|
||||||
|
traceExporter agenttracepb.TraceService_ExportClient
|
||||||
|
metricsExporter agentmetricspb.MetricsService_ExportClient
|
||||||
|
nodeInfo *commonpb.Node
|
||||||
|
grpcClientConn *grpc.ClientConn
|
||||||
|
reconnectionPeriod time.Duration
|
||||||
|
resource *resourcepb.Resource
|
||||||
|
compressor string
|
||||||
|
|
||||||
|
startOnce sync.Once
|
||||||
|
stopCh chan bool
|
||||||
|
disconnectedCh chan bool
|
||||||
|
|
||||||
|
backgroundConnectionDoneCh chan bool
|
||||||
|
|
||||||
|
traceBundler *bundler.Bundler
|
||||||
|
|
||||||
|
// viewDataBundler is the bundler to enable conversion
|
||||||
|
// from OpenCensus-Go view.Data to metricspb.Metric.
|
||||||
|
// Please do not confuse it with metricsBundler!
|
||||||
|
viewDataBundler *bundler.Bundler
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewExporter(opts ...ExporterOption) (*Exporter, error) {
|
||||||
|
exp, err := NewUnstartedExporter(opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := exp.Start(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return exp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
const spanDataBufferSize = 300
|
||||||
|
|
||||||
|
func NewUnstartedExporter(opts ...ExporterOption) (*Exporter, error) {
|
||||||
|
e := new(Exporter)
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt.withExporter(e)
|
||||||
|
}
|
||||||
|
traceBundler := bundler.NewBundler((*trace.SpanData)(nil), func(bundle interface{}) {
|
||||||
|
e.uploadTraces(bundle.([]*trace.SpanData))
|
||||||
|
})
|
||||||
|
traceBundler.DelayThreshold = 2 * time.Second
|
||||||
|
traceBundler.BundleCountThreshold = spanDataBufferSize
|
||||||
|
e.traceBundler = traceBundler
|
||||||
|
|
||||||
|
viewDataBundler := bundler.NewBundler((*view.Data)(nil), func(bundle interface{}) {
|
||||||
|
e.uploadViewData(bundle.([]*view.Data))
|
||||||
|
})
|
||||||
|
viewDataBundler.DelayThreshold = 2 * time.Second
|
||||||
|
viewDataBundler.BundleCountThreshold = 500 // TODO: (@odeke-em) make this configurable.
|
||||||
|
e.viewDataBundler = viewDataBundler
|
||||||
|
e.nodeInfo = NodeWithStartTime(e.serviceName)
|
||||||
|
e.resource = resourceProtoFromEnv()
|
||||||
|
|
||||||
|
return e, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
maxInitialConfigRetries = 10
|
||||||
|
maxInitialTracesRetries = 10
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
errAlreadyStarted = errors.New("already started")
|
||||||
|
errNotStarted = errors.New("not started")
|
||||||
|
errStopped = errors.New("stopped")
|
||||||
|
errNoConnection = errors.New("no active connection")
|
||||||
|
)
|
||||||
|
|
||||||
|
// Start dials to the agent, establishing a connection to it. It also
|
||||||
|
// initiates the Config and Trace services by sending over the initial
|
||||||
|
// messages that consist of the node identifier. Start invokes a background
|
||||||
|
// connector that will reattempt connections to the agent periodically
|
||||||
|
// if the connection dies.
|
||||||
|
func (ae *Exporter) Start() error {
|
||||||
|
var err = errAlreadyStarted
|
||||||
|
ae.startOnce.Do(func() {
|
||||||
|
ae.mu.Lock()
|
||||||
|
defer ae.mu.Unlock()
|
||||||
|
|
||||||
|
ae.started = true
|
||||||
|
ae.disconnectedCh = make(chan bool, 1)
|
||||||
|
ae.stopCh = make(chan bool)
|
||||||
|
ae.backgroundConnectionDoneCh = make(chan bool)
|
||||||
|
|
||||||
|
ae.setStateDisconnected()
|
||||||
|
go ae.indefiniteBackgroundConnection()
|
||||||
|
|
||||||
|
err = nil
|
||||||
|
})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) prepareAgentAddress() string {
|
||||||
|
if ae.agentAddress != "" {
|
||||||
|
return ae.agentAddress
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s:%d", DefaultAgentHost, DefaultAgentPort)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) enableConnectionStreams(cc *grpc.ClientConn) error {
|
||||||
|
ae.mu.RLock()
|
||||||
|
started := ae.started
|
||||||
|
nodeInfo := ae.nodeInfo
|
||||||
|
ae.mu.RUnlock()
|
||||||
|
|
||||||
|
if !started {
|
||||||
|
return errNotStarted
|
||||||
|
}
|
||||||
|
|
||||||
|
ae.mu.Lock()
|
||||||
|
// If the previous clientConn was non-nil, close it
|
||||||
|
if ae.grpcClientConn != nil {
|
||||||
|
_ = ae.grpcClientConn.Close()
|
||||||
|
}
|
||||||
|
ae.grpcClientConn = cc
|
||||||
|
ae.mu.Unlock()
|
||||||
|
|
||||||
|
if err := ae.createTraceServiceConnection(ae.grpcClientConn, nodeInfo); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return ae.createMetricsServiceConnection(ae.grpcClientConn, nodeInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) createTraceServiceConnection(cc *grpc.ClientConn, node *commonpb.Node) error {
|
||||||
|
// Initiate the trace service by sending over node identifier info.
|
||||||
|
traceSvcClient := agenttracepb.NewTraceServiceClient(cc)
|
||||||
|
traceExporter, err := traceSvcClient.Export(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Exporter.Start:: TraceServiceClient: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
firstTraceMessage := &agenttracepb.ExportTraceServiceRequest{
|
||||||
|
Node: node,
|
||||||
|
Resource: ae.resource,
|
||||||
|
}
|
||||||
|
if err := traceExporter.Send(firstTraceMessage); err != nil {
|
||||||
|
return fmt.Errorf("Exporter.Start:: Failed to initiate the Config service: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ae.mu.Lock()
|
||||||
|
ae.traceExporter = traceExporter
|
||||||
|
ae.mu.Unlock()
|
||||||
|
|
||||||
|
// Initiate the config service by sending over node identifier info.
|
||||||
|
configStream, err := traceSvcClient.Config(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Exporter.Start:: ConfigStream: %v", err)
|
||||||
|
}
|
||||||
|
firstCfgMessage := &agenttracepb.CurrentLibraryConfig{Node: node}
|
||||||
|
if err := configStream.Send(firstCfgMessage); err != nil {
|
||||||
|
return fmt.Errorf("Exporter.Start:: Failed to initiate the Config service: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// In the background, handle trace configurations that are beamed down
|
||||||
|
// by the agent, but also reply to it with the applied configuration.
|
||||||
|
go ae.handleConfigStreaming(configStream)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) createMetricsServiceConnection(cc *grpc.ClientConn, node *commonpb.Node) error {
|
||||||
|
metricsSvcClient := agentmetricspb.NewMetricsServiceClient(cc)
|
||||||
|
metricsExporter, err := metricsSvcClient.Export(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("MetricsExporter: failed to start the service client: %v", err)
|
||||||
|
}
|
||||||
|
// Initiate the metrics service by sending over the first message just containing the Node and Resource.
|
||||||
|
firstMetricsMessage := &agentmetricspb.ExportMetricsServiceRequest{
|
||||||
|
Node: node,
|
||||||
|
Resource: ae.resource,
|
||||||
|
}
|
||||||
|
if err := metricsExporter.Send(firstMetricsMessage); err != nil {
|
||||||
|
return fmt.Errorf("MetricsExporter:: failed to send the first message: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ae.mu.Lock()
|
||||||
|
ae.metricsExporter = metricsExporter
|
||||||
|
ae.mu.Unlock()
|
||||||
|
|
||||||
|
// With that we are good to go and can start sending metrics
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) dialToAgent() (*grpc.ClientConn, error) {
|
||||||
|
addr := ae.prepareAgentAddress()
|
||||||
|
var dialOpts []grpc.DialOption
|
||||||
|
if ae.canDialInsecure {
|
||||||
|
dialOpts = append(dialOpts, grpc.WithInsecure())
|
||||||
|
}
|
||||||
|
if ae.compressor != "" {
|
||||||
|
dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.UseCompressor(ae.compressor)))
|
||||||
|
}
|
||||||
|
return grpc.Dial(addr, dialOpts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) handleConfigStreaming(configStream agenttracepb.TraceService_ConfigClient) error {
|
||||||
|
// Note: We haven't yet implemented configuration sending so we
|
||||||
|
// should NOT be changing connection states within this function for now.
|
||||||
|
for {
|
||||||
|
recv, err := configStream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
// TODO: Check if this is a transient error or exponential backoff-able.
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cfg := recv.Config
|
||||||
|
if cfg == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise now apply the trace configuration sent down from the agent
|
||||||
|
if psamp := cfg.GetProbabilitySampler(); psamp != nil {
|
||||||
|
trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(psamp.SamplingProbability)})
|
||||||
|
} else if csamp := cfg.GetConstantSampler(); csamp != nil {
|
||||||
|
alwaysSample := csamp.Decision == true
|
||||||
|
if alwaysSample {
|
||||||
|
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
|
||||||
|
} else {
|
||||||
|
trace.ApplyConfig(trace.Config{DefaultSampler: trace.NeverSample()})
|
||||||
|
}
|
||||||
|
} else { // TODO: Add the rate limiting sampler here
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then finally send back to upstream the newly applied configuration
|
||||||
|
err = configStream.Send(&agenttracepb.CurrentLibraryConfig{Config: &tracepb.TraceConfig{Sampler: cfg.Sampler}})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop shuts down all the connections and resources
|
||||||
|
// related to the exporter.
|
||||||
|
func (ae *Exporter) Stop() error {
|
||||||
|
ae.mu.RLock()
|
||||||
|
cc := ae.grpcClientConn
|
||||||
|
started := ae.started
|
||||||
|
stopped := ae.stopped
|
||||||
|
ae.mu.RUnlock()
|
||||||
|
|
||||||
|
if !started {
|
||||||
|
return errNotStarted
|
||||||
|
}
|
||||||
|
if stopped {
|
||||||
|
// TODO: tell the user that we've already stopped, so perhaps a sentinel error?
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ae.Flush()
|
||||||
|
|
||||||
|
// Now close the underlying gRPC connection.
|
||||||
|
var err error
|
||||||
|
if cc != nil {
|
||||||
|
err = cc.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point we can change the state variables: started and stopped
|
||||||
|
ae.mu.Lock()
|
||||||
|
ae.started = false
|
||||||
|
ae.stopped = true
|
||||||
|
ae.mu.Unlock()
|
||||||
|
close(ae.stopCh)
|
||||||
|
|
||||||
|
// Ensure that the backgroundConnector returns
|
||||||
|
<-ae.backgroundConnectionDoneCh
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) ExportSpan(sd *trace.SpanData) {
|
||||||
|
if sd == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_ = ae.traceBundler.Add(sd, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) ExportTraceServiceRequest(batch *agenttracepb.ExportTraceServiceRequest) error {
|
||||||
|
if batch == nil || len(batch.Spans) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-ae.stopCh:
|
||||||
|
return errStopped
|
||||||
|
|
||||||
|
default:
|
||||||
|
if !ae.connected() {
|
||||||
|
return errNoConnection
|
||||||
|
}
|
||||||
|
|
||||||
|
ae.senderMu.Lock()
|
||||||
|
err := ae.traceExporter.Send(batch)
|
||||||
|
ae.senderMu.Unlock()
|
||||||
|
if err != nil {
|
||||||
|
ae.setStateDisconnected()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) ExportView(vd *view.Data) {
|
||||||
|
if vd == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_ = ae.viewDataBundler.Add(vd, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocSpanDataToPbSpans(sdl []*trace.SpanData) []*tracepb.Span {
|
||||||
|
if len(sdl) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
protoSpans := make([]*tracepb.Span, 0, len(sdl))
|
||||||
|
for _, sd := range sdl {
|
||||||
|
if sd != nil {
|
||||||
|
protoSpans = append(protoSpans, ocSpanToProtoSpan(sd))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return protoSpans
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) uploadTraces(sdl []*trace.SpanData) {
|
||||||
|
select {
|
||||||
|
case <-ae.stopCh:
|
||||||
|
return
|
||||||
|
|
||||||
|
default:
|
||||||
|
if !ae.connected() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
protoSpans := ocSpanDataToPbSpans(sdl)
|
||||||
|
if len(protoSpans) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ae.senderMu.Lock()
|
||||||
|
err := ae.traceExporter.Send(&agenttracepb.ExportTraceServiceRequest{
|
||||||
|
Spans: protoSpans,
|
||||||
|
})
|
||||||
|
ae.senderMu.Unlock()
|
||||||
|
if err != nil {
|
||||||
|
ae.setStateDisconnected()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocViewDataToPbMetrics(vdl []*view.Data) []*metricspb.Metric {
|
||||||
|
if len(vdl) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
metrics := make([]*metricspb.Metric, 0, len(vdl))
|
||||||
|
for _, vd := range vdl {
|
||||||
|
if vd != nil {
|
||||||
|
vmetric, err := viewDataToMetric(vd)
|
||||||
|
// TODO: (@odeke-em) somehow report this error, if it is non-nil.
|
||||||
|
if err == nil && vmetric != nil {
|
||||||
|
metrics = append(metrics, vmetric)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return metrics
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) uploadViewData(vdl []*view.Data) {
|
||||||
|
select {
|
||||||
|
case <-ae.stopCh:
|
||||||
|
return
|
||||||
|
|
||||||
|
default:
|
||||||
|
if !ae.connected() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
protoMetrics := ocViewDataToPbMetrics(vdl)
|
||||||
|
if len(protoMetrics) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := ae.metricsExporter.Send(&agentmetricspb.ExportMetricsServiceRequest{
|
||||||
|
Metrics: protoMetrics,
|
||||||
|
// TODO:(@odeke-em)
|
||||||
|
// a) Figure out how to derive a Node from the environment
|
||||||
|
// b) Figure out how to derive a Resource from the environment
|
||||||
|
// or better letting users of the exporter configure it.
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ae.setStateDisconnected()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ae *Exporter) Flush() {
|
||||||
|
ae.traceBundler.Flush()
|
||||||
|
ae.viewDataBundler.Flush()
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceProtoFromEnv() *resourcepb.Resource {
|
||||||
|
rs, _ := resource.FromEnv(context.Background())
|
||||||
|
if rs == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
rprs := &resourcepb.Resource{
|
||||||
|
Type: rs.Type,
|
||||||
|
}
|
||||||
|
if rs.Labels != nil {
|
||||||
|
rprs.Labels = make(map[string]string)
|
||||||
|
for k, v := range rs.Labels {
|
||||||
|
rprs.Labels[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rprs
|
||||||
|
}
|
93
vendor/contrib.go.opencensus.io/exporter/ocagent/options.go
generated
vendored
Normal file
93
vendor/contrib.go.opencensus.io/exporter/ocagent/options.go
generated
vendored
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultAgentPort uint16 = 55678
|
||||||
|
DefaultAgentHost string = "localhost"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ExporterOption interface {
|
||||||
|
withExporter(e *Exporter)
|
||||||
|
}
|
||||||
|
|
||||||
|
type insecureGrpcConnection int
|
||||||
|
|
||||||
|
var _ ExporterOption = (*insecureGrpcConnection)(nil)
|
||||||
|
|
||||||
|
func (igc *insecureGrpcConnection) withExporter(e *Exporter) {
|
||||||
|
e.canDialInsecure = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithInsecure disables client transport security for the exporter's gRPC connection
|
||||||
|
// just like grpc.WithInsecure() https://godoc.org/google.golang.org/grpc#WithInsecure
|
||||||
|
// does. Note, by default, client security is required unless WithInsecure is used.
|
||||||
|
func WithInsecure() ExporterOption { return new(insecureGrpcConnection) }
|
||||||
|
|
||||||
|
type addressSetter string
|
||||||
|
|
||||||
|
func (as addressSetter) withExporter(e *Exporter) {
|
||||||
|
e.agentAddress = string(as)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ ExporterOption = (*addressSetter)(nil)
|
||||||
|
|
||||||
|
// WithAddress allows one to set the address that the exporter will
|
||||||
|
// connect to the agent on. If unset, it will instead try to use
|
||||||
|
// connect to DefaultAgentHost:DefaultAgentPort
|
||||||
|
func WithAddress(addr string) ExporterOption {
|
||||||
|
return addressSetter(addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
type serviceNameSetter string
|
||||||
|
|
||||||
|
func (sns serviceNameSetter) withExporter(e *Exporter) {
|
||||||
|
e.serviceName = string(sns)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ ExporterOption = (*serviceNameSetter)(nil)
|
||||||
|
|
||||||
|
// WithServiceName allows one to set/override the service name
|
||||||
|
// that the exporter will report to the agent.
|
||||||
|
func WithServiceName(serviceName string) ExporterOption {
|
||||||
|
return serviceNameSetter(serviceName)
|
||||||
|
}
|
||||||
|
|
||||||
|
type reconnectionPeriod time.Duration
|
||||||
|
|
||||||
|
func (rp reconnectionPeriod) withExporter(e *Exporter) {
|
||||||
|
e.reconnectionPeriod = time.Duration(rp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithReconnectionPeriod(rp time.Duration) ExporterOption {
|
||||||
|
return reconnectionPeriod(rp)
|
||||||
|
}
|
||||||
|
|
||||||
|
type compressorSetter string
|
||||||
|
|
||||||
|
func (c compressorSetter) withExporter(e *Exporter) {
|
||||||
|
e.compressor = string(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UseCompressor will set the compressor for the gRPC client to use when sending requests.
|
||||||
|
// It is the responsibility of the caller to ensure that the compressor set has been registered
|
||||||
|
// with google.golang.org/grpc/encoding. This can be done by encoding.RegisterCompressor. Some
|
||||||
|
// compressors auto-register on import, such as gzip, which can be registered by calling
|
||||||
|
// `import _ "google.golang.org/grpc/encoding/gzip"`
|
||||||
|
func UseCompressor(compressorName string) ExporterOption {
|
||||||
|
return compressorSetter(compressorName)
|
||||||
|
}
|
248
vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go
generated
vendored
Normal file
248
vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go
generated
vendored
Normal file
|
@ -0,0 +1,248 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.opencensus.io/trace"
|
||||||
|
"go.opencensus.io/trace/tracestate"
|
||||||
|
|
||||||
|
tracepb "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
maxAnnotationEventsPerSpan = 32
|
||||||
|
maxMessageEventsPerSpan = 128
|
||||||
|
)
|
||||||
|
|
||||||
|
func ocSpanToProtoSpan(sd *trace.SpanData) *tracepb.Span {
|
||||||
|
if sd == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
var namePtr *tracepb.TruncatableString
|
||||||
|
if sd.Name != "" {
|
||||||
|
namePtr = &tracepb.TruncatableString{Value: sd.Name}
|
||||||
|
}
|
||||||
|
return &tracepb.Span{
|
||||||
|
TraceId: sd.TraceID[:],
|
||||||
|
SpanId: sd.SpanID[:],
|
||||||
|
ParentSpanId: sd.ParentSpanID[:],
|
||||||
|
Status: ocStatusToProtoStatus(sd.Status),
|
||||||
|
StartTime: timeToTimestamp(sd.StartTime),
|
||||||
|
EndTime: timeToTimestamp(sd.EndTime),
|
||||||
|
Links: ocLinksToProtoLinks(sd.Links),
|
||||||
|
Kind: ocSpanKindToProtoSpanKind(sd.SpanKind),
|
||||||
|
Name: namePtr,
|
||||||
|
Attributes: ocAttributesToProtoAttributes(sd.Attributes),
|
||||||
|
TimeEvents: ocTimeEventsToProtoTimeEvents(sd.Annotations, sd.MessageEvents),
|
||||||
|
Tracestate: ocTracestateToProtoTracestate(sd.Tracestate),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var blankStatus trace.Status
|
||||||
|
|
||||||
|
func ocStatusToProtoStatus(status trace.Status) *tracepb.Status {
|
||||||
|
if status == blankStatus {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &tracepb.Status{
|
||||||
|
Code: status.Code,
|
||||||
|
Message: status.Message,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocLinksToProtoLinks(links []trace.Link) *tracepb.Span_Links {
|
||||||
|
if len(links) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
sl := make([]*tracepb.Span_Link, 0, len(links))
|
||||||
|
for _, ocLink := range links {
|
||||||
|
// This redefinition is necessary to prevent ocLink.*ID[:] copies
|
||||||
|
// being reused -- in short we need a new ocLink per iteration.
|
||||||
|
ocLink := ocLink
|
||||||
|
|
||||||
|
sl = append(sl, &tracepb.Span_Link{
|
||||||
|
TraceId: ocLink.TraceID[:],
|
||||||
|
SpanId: ocLink.SpanID[:],
|
||||||
|
Type: ocLinkTypeToProtoLinkType(ocLink.Type),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return &tracepb.Span_Links{
|
||||||
|
Link: sl,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocLinkTypeToProtoLinkType(oct trace.LinkType) tracepb.Span_Link_Type {
|
||||||
|
switch oct {
|
||||||
|
case trace.LinkTypeChild:
|
||||||
|
return tracepb.Span_Link_CHILD_LINKED_SPAN
|
||||||
|
case trace.LinkTypeParent:
|
||||||
|
return tracepb.Span_Link_PARENT_LINKED_SPAN
|
||||||
|
default:
|
||||||
|
return tracepb.Span_Link_TYPE_UNSPECIFIED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocAttributesToProtoAttributes(attrs map[string]interface{}) *tracepb.Span_Attributes {
|
||||||
|
if len(attrs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
outMap := make(map[string]*tracepb.AttributeValue)
|
||||||
|
for k, v := range attrs {
|
||||||
|
switch v := v.(type) {
|
||||||
|
case bool:
|
||||||
|
outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_BoolValue{BoolValue: v}}
|
||||||
|
|
||||||
|
case int:
|
||||||
|
outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_IntValue{IntValue: int64(v)}}
|
||||||
|
|
||||||
|
case int64:
|
||||||
|
outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_IntValue{IntValue: v}}
|
||||||
|
|
||||||
|
case string:
|
||||||
|
outMap[k] = &tracepb.AttributeValue{
|
||||||
|
Value: &tracepb.AttributeValue_StringValue{
|
||||||
|
StringValue: &tracepb.TruncatableString{Value: v},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &tracepb.Span_Attributes{
|
||||||
|
AttributeMap: outMap,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This code is mostly copied from
|
||||||
|
// https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/blob/master/trace_proto.go#L46
|
||||||
|
func ocTimeEventsToProtoTimeEvents(as []trace.Annotation, es []trace.MessageEvent) *tracepb.Span_TimeEvents {
|
||||||
|
if len(as) == 0 && len(es) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
timeEvents := &tracepb.Span_TimeEvents{}
|
||||||
|
var annotations, droppedAnnotationsCount int
|
||||||
|
var messageEvents, droppedMessageEventsCount int
|
||||||
|
|
||||||
|
// Transform annotations
|
||||||
|
for i, a := range as {
|
||||||
|
if annotations >= maxAnnotationEventsPerSpan {
|
||||||
|
droppedAnnotationsCount = len(as) - i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
annotations++
|
||||||
|
timeEvents.TimeEvent = append(timeEvents.TimeEvent,
|
||||||
|
&tracepb.Span_TimeEvent{
|
||||||
|
Time: timeToTimestamp(a.Time),
|
||||||
|
Value: transformAnnotationToTimeEvent(&a),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transform message events
|
||||||
|
for i, e := range es {
|
||||||
|
if messageEvents >= maxMessageEventsPerSpan {
|
||||||
|
droppedMessageEventsCount = len(es) - i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
messageEvents++
|
||||||
|
timeEvents.TimeEvent = append(timeEvents.TimeEvent,
|
||||||
|
&tracepb.Span_TimeEvent{
|
||||||
|
Time: timeToTimestamp(e.Time),
|
||||||
|
Value: transformMessageEventToTimeEvent(&e),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process dropped counter
|
||||||
|
timeEvents.DroppedAnnotationsCount = clip32(droppedAnnotationsCount)
|
||||||
|
timeEvents.DroppedMessageEventsCount = clip32(droppedMessageEventsCount)
|
||||||
|
|
||||||
|
return timeEvents
|
||||||
|
}
|
||||||
|
|
||||||
|
func transformAnnotationToTimeEvent(a *trace.Annotation) *tracepb.Span_TimeEvent_Annotation_ {
|
||||||
|
return &tracepb.Span_TimeEvent_Annotation_{
|
||||||
|
Annotation: &tracepb.Span_TimeEvent_Annotation{
|
||||||
|
Description: &tracepb.TruncatableString{Value: a.Message},
|
||||||
|
Attributes: ocAttributesToProtoAttributes(a.Attributes),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func transformMessageEventToTimeEvent(e *trace.MessageEvent) *tracepb.Span_TimeEvent_MessageEvent_ {
|
||||||
|
return &tracepb.Span_TimeEvent_MessageEvent_{
|
||||||
|
MessageEvent: &tracepb.Span_TimeEvent_MessageEvent{
|
||||||
|
Type: tracepb.Span_TimeEvent_MessageEvent_Type(e.EventType),
|
||||||
|
Id: uint64(e.MessageID),
|
||||||
|
UncompressedSize: uint64(e.UncompressedByteSize),
|
||||||
|
CompressedSize: uint64(e.CompressedByteSize),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clip32 clips an int to the range of an int32.
|
||||||
|
func clip32(x int) int32 {
|
||||||
|
if x < math.MinInt32 {
|
||||||
|
return math.MinInt32
|
||||||
|
}
|
||||||
|
if x > math.MaxInt32 {
|
||||||
|
return math.MaxInt32
|
||||||
|
}
|
||||||
|
return int32(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func timeToTimestamp(t time.Time) *timestamp.Timestamp {
|
||||||
|
nanoTime := t.UnixNano()
|
||||||
|
return ×tamp.Timestamp{
|
||||||
|
Seconds: nanoTime / 1e9,
|
||||||
|
Nanos: int32(nanoTime % 1e9),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocSpanKindToProtoSpanKind(kind int) tracepb.Span_SpanKind {
|
||||||
|
switch kind {
|
||||||
|
case trace.SpanKindClient:
|
||||||
|
return tracepb.Span_CLIENT
|
||||||
|
case trace.SpanKindServer:
|
||||||
|
return tracepb.Span_SERVER
|
||||||
|
default:
|
||||||
|
return tracepb.Span_SPAN_KIND_UNSPECIFIED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocTracestateToProtoTracestate(ts *tracestate.Tracestate) *tracepb.Span_Tracestate {
|
||||||
|
if ts == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &tracepb.Span_Tracestate{
|
||||||
|
Entries: ocTracestateEntriesToProtoTracestateEntries(ts.Entries()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ocTracestateEntriesToProtoTracestateEntries(entries []tracestate.Entry) []*tracepb.Span_Tracestate_Entry {
|
||||||
|
protoEntries := make([]*tracepb.Span_Tracestate_Entry, 0, len(entries))
|
||||||
|
for _, entry := range entries {
|
||||||
|
protoEntries = append(protoEntries, &tracepb.Span_Tracestate_Entry{
|
||||||
|
Key: entry.Key,
|
||||||
|
Value: entry.Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return protoEntries
|
||||||
|
}
|
294
vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go
generated
vendored
Normal file
294
vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go
generated
vendored
Normal file
|
@ -0,0 +1,294 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.opencensus.io/exemplar"
|
||||||
|
"go.opencensus.io/stats"
|
||||||
|
"go.opencensus.io/stats/view"
|
||||||
|
"go.opencensus.io/tag"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
|
|
||||||
|
metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
errNilMeasure = errors.New("expecting a non-nil stats.Measure")
|
||||||
|
errNilView = errors.New("expecting a non-nil view.View")
|
||||||
|
errNilViewData = errors.New("expecting a non-nil view.Data")
|
||||||
|
)
|
||||||
|
|
||||||
|
func viewDataToMetric(vd *view.Data) (*metricspb.Metric, error) {
|
||||||
|
if vd == nil {
|
||||||
|
return nil, errNilViewData
|
||||||
|
}
|
||||||
|
|
||||||
|
descriptor, err := viewToMetricDescriptor(vd.View)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
timeseries, err := viewDataToTimeseries(vd)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
metric := &metricspb.Metric{
|
||||||
|
Descriptor_: descriptor,
|
||||||
|
Timeseries: timeseries,
|
||||||
|
}
|
||||||
|
return metric, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func viewToMetricDescriptor(v *view.View) (*metricspb.Metric_MetricDescriptor, error) {
|
||||||
|
if v == nil {
|
||||||
|
return nil, errNilView
|
||||||
|
}
|
||||||
|
if v.Measure == nil {
|
||||||
|
return nil, errNilMeasure
|
||||||
|
}
|
||||||
|
|
||||||
|
desc := &metricspb.Metric_MetricDescriptor{
|
||||||
|
MetricDescriptor: &metricspb.MetricDescriptor{
|
||||||
|
Name: stringOrCall(v.Name, v.Measure.Name),
|
||||||
|
Description: stringOrCall(v.Description, v.Measure.Description),
|
||||||
|
Unit: v.Measure.Unit(),
|
||||||
|
Type: aggregationToMetricDescriptorType(v),
|
||||||
|
LabelKeys: tagKeysToLabelKeys(v.TagKeys),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return desc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func stringOrCall(first string, call func() string) string {
|
||||||
|
if first != "" {
|
||||||
|
return first
|
||||||
|
}
|
||||||
|
return call()
|
||||||
|
}
|
||||||
|
|
||||||
|
type measureType uint
|
||||||
|
|
||||||
|
const (
|
||||||
|
measureUnknown measureType = iota
|
||||||
|
measureInt64
|
||||||
|
measureFloat64
|
||||||
|
)
|
||||||
|
|
||||||
|
func measureTypeFromMeasure(m stats.Measure) measureType {
|
||||||
|
switch m.(type) {
|
||||||
|
default:
|
||||||
|
return measureUnknown
|
||||||
|
case *stats.Float64Measure:
|
||||||
|
return measureFloat64
|
||||||
|
case *stats.Int64Measure:
|
||||||
|
return measureInt64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func aggregationToMetricDescriptorType(v *view.View) metricspb.MetricDescriptor_Type {
|
||||||
|
if v == nil || v.Aggregation == nil {
|
||||||
|
return metricspb.MetricDescriptor_UNSPECIFIED
|
||||||
|
}
|
||||||
|
if v.Measure == nil {
|
||||||
|
return metricspb.MetricDescriptor_UNSPECIFIED
|
||||||
|
}
|
||||||
|
|
||||||
|
switch v.Aggregation.Type {
|
||||||
|
case view.AggTypeCount:
|
||||||
|
// Cumulative on int64
|
||||||
|
return metricspb.MetricDescriptor_CUMULATIVE_INT64
|
||||||
|
|
||||||
|
case view.AggTypeDistribution:
|
||||||
|
// Cumulative types
|
||||||
|
return metricspb.MetricDescriptor_CUMULATIVE_DISTRIBUTION
|
||||||
|
|
||||||
|
case view.AggTypeLastValue:
|
||||||
|
// Gauge types
|
||||||
|
switch measureTypeFromMeasure(v.Measure) {
|
||||||
|
case measureFloat64:
|
||||||
|
return metricspb.MetricDescriptor_GAUGE_DOUBLE
|
||||||
|
case measureInt64:
|
||||||
|
return metricspb.MetricDescriptor_GAUGE_INT64
|
||||||
|
}
|
||||||
|
|
||||||
|
case view.AggTypeSum:
|
||||||
|
// Cumulative types
|
||||||
|
switch measureTypeFromMeasure(v.Measure) {
|
||||||
|
case measureFloat64:
|
||||||
|
return metricspb.MetricDescriptor_CUMULATIVE_DOUBLE
|
||||||
|
case measureInt64:
|
||||||
|
return metricspb.MetricDescriptor_CUMULATIVE_INT64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For all other cases, return unspecified.
|
||||||
|
return metricspb.MetricDescriptor_UNSPECIFIED
|
||||||
|
}
|
||||||
|
|
||||||
|
func tagKeysToLabelKeys(tagKeys []tag.Key) []*metricspb.LabelKey {
|
||||||
|
labelKeys := make([]*metricspb.LabelKey, 0, len(tagKeys))
|
||||||
|
for _, tagKey := range tagKeys {
|
||||||
|
labelKeys = append(labelKeys, &metricspb.LabelKey{
|
||||||
|
Key: tagKey.Name(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return labelKeys
|
||||||
|
}
|
||||||
|
|
||||||
|
func viewDataToTimeseries(vd *view.Data) ([]*metricspb.TimeSeries, error) {
|
||||||
|
if vd == nil || len(vd.Rows) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given that view.Data only contains Start, End
|
||||||
|
// the timestamps for all the row data will be the exact same
|
||||||
|
// per aggregation. However, the values will differ.
|
||||||
|
// Each row has its own tags.
|
||||||
|
startTimestamp := timeToProtoTimestamp(vd.Start)
|
||||||
|
endTimestamp := timeToProtoTimestamp(vd.End)
|
||||||
|
|
||||||
|
mType := measureTypeFromMeasure(vd.View.Measure)
|
||||||
|
timeseries := make([]*metricspb.TimeSeries, 0, len(vd.Rows))
|
||||||
|
// It is imperative that the ordering of "LabelValues" matches those
|
||||||
|
// of the Label keys in the metric descriptor.
|
||||||
|
for _, row := range vd.Rows {
|
||||||
|
labelValues := labelValuesFromTags(row.Tags)
|
||||||
|
point := rowToPoint(vd.View, row, endTimestamp, mType)
|
||||||
|
timeseries = append(timeseries, &metricspb.TimeSeries{
|
||||||
|
StartTimestamp: startTimestamp,
|
||||||
|
LabelValues: labelValues,
|
||||||
|
Points: []*metricspb.Point{point},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(timeseries) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return timeseries, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func timeToProtoTimestamp(t time.Time) *timestamp.Timestamp {
|
||||||
|
unixNano := t.UnixNano()
|
||||||
|
return ×tamp.Timestamp{
|
||||||
|
Seconds: int64(unixNano / 1e9),
|
||||||
|
Nanos: int32(unixNano % 1e9),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func rowToPoint(v *view.View, row *view.Row, endTimestamp *timestamp.Timestamp, mType measureType) *metricspb.Point {
|
||||||
|
pt := &metricspb.Point{
|
||||||
|
Timestamp: endTimestamp,
|
||||||
|
}
|
||||||
|
|
||||||
|
switch data := row.Data.(type) {
|
||||||
|
case *view.CountData:
|
||||||
|
pt.Value = &metricspb.Point_Int64Value{Int64Value: data.Value}
|
||||||
|
|
||||||
|
case *view.DistributionData:
|
||||||
|
pt.Value = &metricspb.Point_DistributionValue{
|
||||||
|
DistributionValue: &metricspb.DistributionValue{
|
||||||
|
Count: data.Count,
|
||||||
|
Sum: float64(data.Count) * data.Mean, // because Mean := Sum/Count
|
||||||
|
Buckets: bucketsToProtoBuckets(data.CountPerBucket, data.ExemplarsPerBucket),
|
||||||
|
BucketOptions: &metricspb.DistributionValue_BucketOptions{
|
||||||
|
Type: &metricspb.DistributionValue_BucketOptions_Explicit_{
|
||||||
|
Explicit: &metricspb.DistributionValue_BucketOptions_Explicit{
|
||||||
|
Bounds: v.Aggregation.Buckets,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SumOfSquaredDeviation: data.SumOfSquaredDev,
|
||||||
|
}}
|
||||||
|
|
||||||
|
case *view.LastValueData:
|
||||||
|
setPointValue(pt, data.Value, mType)
|
||||||
|
|
||||||
|
case *view.SumData:
|
||||||
|
setPointValue(pt, data.Value, mType)
|
||||||
|
}
|
||||||
|
|
||||||
|
return pt
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not returning anything from this function because metricspb.Point.is_Value is an unexported
|
||||||
|
// interface hence we just have to set its value by pointer.
|
||||||
|
func setPointValue(pt *metricspb.Point, value float64, mType measureType) {
|
||||||
|
if mType == measureInt64 {
|
||||||
|
pt.Value = &metricspb.Point_Int64Value{Int64Value: int64(value)}
|
||||||
|
} else {
|
||||||
|
pt.Value = &metricspb.Point_DoubleValue{DoubleValue: value}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// countPerBucket and exemplars are of the same length in well formed data,
|
||||||
|
// otherwise ensure that even if exemplars are non-existent that we always
|
||||||
|
// insert counts and create distribution value buckets.
|
||||||
|
func bucketsToProtoBuckets(countPerBucket []int64, exemplars []*exemplar.Exemplar) []*metricspb.DistributionValue_Bucket {
|
||||||
|
distBuckets := make([]*metricspb.DistributionValue_Bucket, len(countPerBucket))
|
||||||
|
for i := 0; i < len(countPerBucket); i++ {
|
||||||
|
count := countPerBucket[i]
|
||||||
|
|
||||||
|
var exmplr *exemplar.Exemplar
|
||||||
|
if i < len(exemplars) {
|
||||||
|
exmplr = exemplars[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
var protoExemplar *metricspb.DistributionValue_Exemplar
|
||||||
|
if exmplr != nil {
|
||||||
|
protoExemplar = &metricspb.DistributionValue_Exemplar{
|
||||||
|
Value: exmplr.Value,
|
||||||
|
Timestamp: timeToTimestamp(exmplr.Timestamp),
|
||||||
|
Attachments: exmplr.Attachments,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
distBuckets[i] = &metricspb.DistributionValue_Bucket{
|
||||||
|
Count: count,
|
||||||
|
Exemplar: protoExemplar,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return distBuckets
|
||||||
|
}
|
||||||
|
|
||||||
|
func labelValuesFromTags(tags []tag.Tag) []*metricspb.LabelValue {
|
||||||
|
if len(tags) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
labelValues := make([]*metricspb.LabelValue, 0, len(tags))
|
||||||
|
for _, tag_ := range tags {
|
||||||
|
labelValues = append(labelValues, &metricspb.LabelValue{
|
||||||
|
Value: tag_.Value,
|
||||||
|
|
||||||
|
// It is imperative that we set the "HasValue" attribute,
|
||||||
|
// in order to distinguish missing a label from the empty string.
|
||||||
|
// https://godoc.org/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1#LabelValue.HasValue
|
||||||
|
//
|
||||||
|
// OpenCensus-Go uses non-pointers for tags as seen by this function's arguments,
|
||||||
|
// so the best case that we can use to distinguish missing labels/tags from the
|
||||||
|
// empty string is by checking if the Tag.Key.Name() != "" to indicate that we have
|
||||||
|
// a value.
|
||||||
|
HasValue: tag_.Key.Name() != "",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return labelValues
|
||||||
|
}
|
17
vendor/contrib.go.opencensus.io/exporter/ocagent/version.go
generated
vendored
Normal file
17
vendor/contrib.go.opencensus.io/exporter/ocagent/version.go
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2018, OpenCensus Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package ocagent
|
||||||
|
|
||||||
|
const Version = "0.0.1"
|
2
vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go
generated
vendored
2
vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go
generated
vendored
|
@ -169,7 +169,7 @@ func (q *Queue) GetMetadata(options *QueueServiceOptions) error {
|
||||||
params = addTimeout(params, options.Timeout)
|
params = addTimeout(params, options.Timeout)
|
||||||
headers = mergeHeaders(headers, headersFromStruct(*options))
|
headers = mergeHeaders(headers, headersFromStruct(*options))
|
||||||
}
|
}
|
||||||
uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), url.Values{"comp": {"metadata"}})
|
uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)
|
||||||
|
|
||||||
resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth)
|
resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
2
vendor/github.com/Azure/azure-sdk-for-go/version/version.go
generated
vendored
2
vendor/github.com/Azure/azure-sdk-for-go/version/version.go
generated
vendored
|
@ -18,4 +18,4 @@ package version
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
|
|
||||||
// Number contains the semantic version of this SDK.
|
// Number contains the semantic version of this SDK.
|
||||||
const Number = "v20.1.0"
|
const Number = "v25.1.0"
|
||||||
|
|
26
vendor/github.com/Azure/go-autorest/autorest/adal/config.go
generated
vendored
26
vendor/github.com/Azure/go-autorest/autorest/adal/config.go
generated
vendored
|
@ -19,10 +19,6 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
activeDirectoryAPIVersion = "1.0"
|
|
||||||
)
|
|
||||||
|
|
||||||
// OAuthConfig represents the endpoints needed
|
// OAuthConfig represents the endpoints needed
|
||||||
// in OAuth operations
|
// in OAuth operations
|
||||||
type OAuthConfig struct {
|
type OAuthConfig struct {
|
||||||
|
@ -46,11 +42,25 @@ func validateStringParam(param, name string) error {
|
||||||
|
|
||||||
// NewOAuthConfig returns an OAuthConfig with tenant specific urls
|
// NewOAuthConfig returns an OAuthConfig with tenant specific urls
|
||||||
func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) {
|
func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) {
|
||||||
|
apiVer := "1.0"
|
||||||
|
return NewOAuthConfigWithAPIVersion(activeDirectoryEndpoint, tenantID, &apiVer)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOAuthConfigWithAPIVersion returns an OAuthConfig with tenant specific urls.
|
||||||
|
// If apiVersion is not nil the "api-version" query parameter will be appended to the endpoint URLs with the specified value.
|
||||||
|
func NewOAuthConfigWithAPIVersion(activeDirectoryEndpoint, tenantID string, apiVersion *string) (*OAuthConfig, error) {
|
||||||
if err := validateStringParam(activeDirectoryEndpoint, "activeDirectoryEndpoint"); err != nil {
|
if err := validateStringParam(activeDirectoryEndpoint, "activeDirectoryEndpoint"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
api := ""
|
||||||
// it's legal for tenantID to be empty so don't validate it
|
// it's legal for tenantID to be empty so don't validate it
|
||||||
const activeDirectoryEndpointTemplate = "%s/oauth2/%s?api-version=%s"
|
if apiVersion != nil {
|
||||||
|
if err := validateStringParam(*apiVersion, "apiVersion"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
api = fmt.Sprintf("?api-version=%s", *apiVersion)
|
||||||
|
}
|
||||||
|
const activeDirectoryEndpointTemplate = "%s/oauth2/%s%s"
|
||||||
u, err := url.Parse(activeDirectoryEndpoint)
|
u, err := url.Parse(activeDirectoryEndpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -59,15 +69,15 @@ func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, err
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
authorizeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "authorize", activeDirectoryAPIVersion))
|
authorizeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "authorize", api))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
tokenURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "token", activeDirectoryAPIVersion))
|
tokenURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "token", api))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", activeDirectoryAPIVersion))
|
deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", api))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/Azure/go-autorest/autorest/adal/sender.go
generated
vendored
2
vendor/github.com/Azure/go-autorest/autorest/adal/sender.go
generated
vendored
|
@ -38,7 +38,7 @@ func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) {
|
||||||
return sf(r)
|
return sf(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the
|
// SendDecorator takes and possibly decorates, by wrapping, a Sender. Decorators may affect the
|
||||||
// http.Request and pass it along or, first, pass the http.Request along then react to the
|
// http.Request and pass it along or, first, pass the http.Request along then react to the
|
||||||
// http.Response result.
|
// http.Response result.
|
||||||
type SendDecorator func(Sender) Sender
|
type SendDecorator func(Sender) Sender
|
||||||
|
|
41
vendor/github.com/Azure/go-autorest/autorest/adal/token.go
generated
vendored
41
vendor/github.com/Azure/go-autorest/autorest/adal/token.go
generated
vendored
|
@ -29,13 +29,12 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Azure/go-autorest/autorest/date"
|
"github.com/Azure/go-autorest/autorest/date"
|
||||||
"github.com/Azure/go-autorest/version"
|
"github.com/Azure/go-autorest/tracing"
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -97,18 +96,27 @@ type RefresherWithContext interface {
|
||||||
type TokenRefreshCallback func(Token) error
|
type TokenRefreshCallback func(Token) error
|
||||||
|
|
||||||
// Token encapsulates the access token used to authorize Azure requests.
|
// Token encapsulates the access token used to authorize Azure requests.
|
||||||
|
// https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-oauth2-client-creds-grant-flow#service-to-service-access-token-response
|
||||||
type Token struct {
|
type Token struct {
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
|
||||||
ExpiresIn string `json:"expires_in"`
|
ExpiresIn json.Number `json:"expires_in"`
|
||||||
ExpiresOn string `json:"expires_on"`
|
ExpiresOn json.Number `json:"expires_on"`
|
||||||
NotBefore string `json:"not_before"`
|
NotBefore json.Number `json:"not_before"`
|
||||||
|
|
||||||
Resource string `json:"resource"`
|
Resource string `json:"resource"`
|
||||||
Type string `json:"token_type"`
|
Type string `json:"token_type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newToken() Token {
|
||||||
|
return Token{
|
||||||
|
ExpiresIn: "0",
|
||||||
|
ExpiresOn: "0",
|
||||||
|
NotBefore: "0",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// IsZero returns true if the token object is zero-initialized.
|
// IsZero returns true if the token object is zero-initialized.
|
||||||
func (t Token) IsZero() bool {
|
func (t Token) IsZero() bool {
|
||||||
return t == Token{}
|
return t == Token{}
|
||||||
|
@ -116,12 +124,12 @@ func (t Token) IsZero() bool {
|
||||||
|
|
||||||
// Expires returns the time.Time when the Token expires.
|
// Expires returns the time.Time when the Token expires.
|
||||||
func (t Token) Expires() time.Time {
|
func (t Token) Expires() time.Time {
|
||||||
s, err := strconv.Atoi(t.ExpiresOn)
|
s, err := t.ExpiresOn.Float64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s = -3600
|
s = -3600
|
||||||
}
|
}
|
||||||
|
|
||||||
expiration := date.NewUnixTimeFromSeconds(float64(s))
|
expiration := date.NewUnixTimeFromSeconds(s)
|
||||||
|
|
||||||
return time.Time(expiration).UTC()
|
return time.Time(expiration).UTC()
|
||||||
}
|
}
|
||||||
|
@ -218,6 +226,8 @@ func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalTo
|
||||||
|
|
||||||
token := jwt.New(jwt.SigningMethodRS256)
|
token := jwt.New(jwt.SigningMethodRS256)
|
||||||
token.Header["x5t"] = thumbprint
|
token.Header["x5t"] = thumbprint
|
||||||
|
x5c := []string{base64.StdEncoding.EncodeToString(secret.Certificate.Raw)}
|
||||||
|
token.Header["x5c"] = x5c
|
||||||
token.Claims = jwt.MapClaims{
|
token.Claims = jwt.MapClaims{
|
||||||
"aud": spt.inner.OauthConfig.TokenEndpoint.String(),
|
"aud": spt.inner.OauthConfig.TokenEndpoint.String(),
|
||||||
"iss": spt.inner.ClientID,
|
"iss": spt.inner.ClientID,
|
||||||
|
@ -375,8 +385,13 @@ func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
spt.refreshLock = &sync.RWMutex{}
|
// Don't override the refreshLock or the sender if those have been already set.
|
||||||
spt.sender = &http.Client{}
|
if spt.refreshLock == nil {
|
||||||
|
spt.refreshLock = &sync.RWMutex{}
|
||||||
|
}
|
||||||
|
if spt.sender == nil {
|
||||||
|
spt.sender = &http.Client{Transport: tracing.Transport}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,6 +429,7 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso
|
||||||
}
|
}
|
||||||
spt := &ServicePrincipalToken{
|
spt := &ServicePrincipalToken{
|
||||||
inner: servicePrincipalToken{
|
inner: servicePrincipalToken{
|
||||||
|
Token: newToken(),
|
||||||
OauthConfig: oauthConfig,
|
OauthConfig: oauthConfig,
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
ClientID: id,
|
ClientID: id,
|
||||||
|
@ -422,7 +438,7 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso
|
||||||
RefreshWithin: defaultRefresh,
|
RefreshWithin: defaultRefresh,
|
||||||
},
|
},
|
||||||
refreshLock: &sync.RWMutex{},
|
refreshLock: &sync.RWMutex{},
|
||||||
sender: &http.Client{},
|
sender: &http.Client{Transport: tracing.Transport},
|
||||||
refreshCallbacks: callbacks,
|
refreshCallbacks: callbacks,
|
||||||
}
|
}
|
||||||
return spt, nil
|
return spt, nil
|
||||||
|
@ -653,6 +669,7 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedI
|
||||||
|
|
||||||
spt := &ServicePrincipalToken{
|
spt := &ServicePrincipalToken{
|
||||||
inner: servicePrincipalToken{
|
inner: servicePrincipalToken{
|
||||||
|
Token: newToken(),
|
||||||
OauthConfig: OAuthConfig{
|
OauthConfig: OAuthConfig{
|
||||||
TokenEndpoint: *msiEndpointURL,
|
TokenEndpoint: *msiEndpointURL,
|
||||||
},
|
},
|
||||||
|
@ -662,7 +679,7 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedI
|
||||||
RefreshWithin: defaultRefresh,
|
RefreshWithin: defaultRefresh,
|
||||||
},
|
},
|
||||||
refreshLock: &sync.RWMutex{},
|
refreshLock: &sync.RWMutex{},
|
||||||
sender: &http.Client{},
|
sender: &http.Client{Transport: tracing.Transport},
|
||||||
refreshCallbacks: callbacks,
|
refreshCallbacks: callbacks,
|
||||||
MaxMSIRefreshAttempts: defaultMaxMSIRefreshAttempts,
|
MaxMSIRefreshAttempts: defaultMaxMSIRefreshAttempts,
|
||||||
}
|
}
|
||||||
|
@ -779,7 +796,7 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err)
|
return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err)
|
||||||
}
|
}
|
||||||
req.Header.Add("User-Agent", version.UserAgent())
|
req.Header.Add("User-Agent", UserAgent())
|
||||||
req = req.WithContext(ctx)
|
req = req.WithContext(ctx)
|
||||||
if !isIMDS(spt.inner.OauthConfig.TokenEndpoint) {
|
if !isIMDS(spt.inner.OauthConfig.TokenEndpoint) {
|
||||||
v := url.Values{}
|
v := url.Values{}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
package version
|
package adal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
// Copyright 2017 Microsoft Corporation
|
// Copyright 2017 Microsoft Corporation
|
||||||
//
|
//
|
||||||
|
@ -14,24 +19,27 @@ package version
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import (
|
const number = "v1.0.0"
|
||||||
"fmt"
|
|
||||||
"runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Number contains the semantic version of this SDK.
|
|
||||||
const Number = "v10.15.3"
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s",
|
ua = fmt.Sprintf("Go/%s (%s-%s) go-autorest/adal/%s",
|
||||||
runtime.Version(),
|
runtime.Version(),
|
||||||
runtime.GOARCH,
|
runtime.GOARCH,
|
||||||
runtime.GOOS,
|
runtime.GOOS,
|
||||||
Number,
|
number,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserAgent returns a string containing the Go version, system archityecture and OS, and the go-autorest version.
|
// UserAgent returns a string containing the Go version, system architecture and OS, and the adal version.
|
||||||
func UserAgent() string {
|
func UserAgent() string {
|
||||||
return userAgent
|
return ua
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddToUserAgent adds an extension to the current user agent
|
||||||
|
func AddToUserAgent(extension string) error {
|
||||||
|
if extension != "" {
|
||||||
|
ua = fmt.Sprintf("%s %s", ua, extension)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("Extension was empty, User Agent remained as '%s'", ua)
|
||||||
}
|
}
|
5
vendor/github.com/Azure/go-autorest/autorest/authorization.go
generated
vendored
5
vendor/github.com/Azure/go-autorest/autorest/authorization.go
generated
vendored
|
@ -21,6 +21,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Azure/go-autorest/autorest/adal"
|
"github.com/Azure/go-autorest/autorest/adal"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -68,7 +69,7 @@ func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[str
|
||||||
return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters}
|
return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Paramaters
|
// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Parameters.
|
||||||
func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator {
|
func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator {
|
||||||
return func(p Preparer) Preparer {
|
return func(p Preparer) Preparer {
|
||||||
return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters))
|
return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters))
|
||||||
|
@ -147,7 +148,7 @@ type BearerAuthorizerCallback struct {
|
||||||
// is invoked when the HTTP request is submitted.
|
// is invoked when the HTTP request is submitted.
|
||||||
func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback {
|
func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback {
|
||||||
if sender == nil {
|
if sender == nil {
|
||||||
sender = &http.Client{}
|
sender = &http.Client{Transport: tracing.Transport}
|
||||||
}
|
}
|
||||||
return &BearerAuthorizerCallback{sender: sender, callback: callback}
|
return &BearerAuthorizerCallback{sender: sender, callback: callback}
|
||||||
}
|
}
|
||||||
|
|
81
vendor/github.com/Azure/go-autorest/autorest/azure/async.go
generated
vendored
81
vendor/github.com/Azure/go-autorest/autorest/azure/async.go
generated
vendored
|
@ -26,6 +26,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Azure/go-autorest/autorest"
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -58,10 +59,7 @@ func NewFuture(req *http.Request) Future {
|
||||||
// with the initial response from an asynchronous operation.
|
// with the initial response from an asynchronous operation.
|
||||||
func NewFutureFromResponse(resp *http.Response) (Future, error) {
|
func NewFutureFromResponse(resp *http.Response) (Future, error) {
|
||||||
pt, err := createPollingTracker(resp)
|
pt, err := createPollingTracker(resp)
|
||||||
if err != nil {
|
return Future{pt: pt}, err
|
||||||
return Future{}, err
|
|
||||||
}
|
|
||||||
return Future{pt: pt}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response returns the last HTTP response.
|
// Response returns the last HTTP response.
|
||||||
|
@ -89,7 +87,23 @@ func (f Future) PollingMethod() PollingMethodType {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done queries the service to see if the operation has completed.
|
// Done queries the service to see if the operation has completed.
|
||||||
|
// Deprecated: Use DoneWithContext()
|
||||||
func (f *Future) Done(sender autorest.Sender) (bool, error) {
|
func (f *Future) Done(sender autorest.Sender) (bool, error) {
|
||||||
|
return f.DoneWithContext(context.Background(), sender)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DoneWithContext queries the service to see if the operation has completed.
|
||||||
|
func (f *Future) DoneWithContext(ctx context.Context, sender autorest.Sender) (done bool, err error) {
|
||||||
|
ctx = tracing.StartSpan(ctx, "github.com/Azure/go-autorest/autorest/azure/async.DoneWithContext")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
resp := f.Response()
|
||||||
|
if resp != nil {
|
||||||
|
sc = resp.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
|
||||||
// support for legacy Future implementation
|
// support for legacy Future implementation
|
||||||
if f.req != nil {
|
if f.req != nil {
|
||||||
resp, err := sender.Do(f.req)
|
resp, err := sender.Do(f.req)
|
||||||
|
@ -110,7 +124,7 @@ func (f *Future) Done(sender autorest.Sender) (bool, error) {
|
||||||
if f.pt.hasTerminated() {
|
if f.pt.hasTerminated() {
|
||||||
return true, f.pt.pollingError()
|
return true, f.pt.pollingError()
|
||||||
}
|
}
|
||||||
if err := f.pt.pollForStatus(sender); err != nil {
|
if err := f.pt.pollForStatus(ctx, sender); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if err := f.pt.checkForErrors(); err != nil {
|
if err := f.pt.checkForErrors(); err != nil {
|
||||||
|
@ -167,11 +181,31 @@ func (f Future) WaitForCompletion(ctx context.Context, client autorest.Client) e
|
||||||
// running operation has completed, the provided context is cancelled, or the client's
|
// running operation has completed, the provided context is cancelled, or the client's
|
||||||
// polling duration has been exceeded. It will retry failed polling attempts based on
|
// polling duration has been exceeded. It will retry failed polling attempts based on
|
||||||
// the retry value defined in the client up to the maximum retry attempts.
|
// the retry value defined in the client up to the maximum retry attempts.
|
||||||
func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Client) error {
|
// If no deadline is specified in the context then the client.PollingDuration will be
|
||||||
ctx, cancel := context.WithTimeout(ctx, client.PollingDuration)
|
// used to determine if a default deadline should be used.
|
||||||
defer cancel()
|
// If PollingDuration is greater than zero the value will be used as the context's timeout.
|
||||||
done, err := f.Done(client)
|
// If PollingDuration is zero then no default deadline will be used.
|
||||||
for attempts := 0; !done; done, err = f.Done(client) {
|
func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Client) (err error) {
|
||||||
|
ctx = tracing.StartSpan(ctx, "github.com/Azure/go-autorest/autorest/azure/async.WaitForCompletionRef")
|
||||||
|
defer func() {
|
||||||
|
sc := -1
|
||||||
|
resp := f.Response()
|
||||||
|
if resp != nil {
|
||||||
|
sc = resp.StatusCode
|
||||||
|
}
|
||||||
|
tracing.EndSpan(ctx, sc, err)
|
||||||
|
}()
|
||||||
|
cancelCtx := ctx
|
||||||
|
// if the provided context already has a deadline don't override it
|
||||||
|
_, hasDeadline := ctx.Deadline()
|
||||||
|
if d := client.PollingDuration; !hasDeadline && d != 0 {
|
||||||
|
var cancel context.CancelFunc
|
||||||
|
cancelCtx, cancel = context.WithTimeout(ctx, d)
|
||||||
|
defer cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
done, err := f.DoneWithContext(ctx, client)
|
||||||
|
for attempts := 0; !done; done, err = f.DoneWithContext(ctx, client) {
|
||||||
if attempts >= client.RetryAttempts {
|
if attempts >= client.RetryAttempts {
|
||||||
return autorest.NewErrorWithError(err, "Future", "WaitForCompletion", f.pt.latestResponse(), "the number of retries has been exceeded")
|
return autorest.NewErrorWithError(err, "Future", "WaitForCompletion", f.pt.latestResponse(), "the number of retries has been exceeded")
|
||||||
}
|
}
|
||||||
|
@ -195,12 +229,12 @@ func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Clien
|
||||||
attempts++
|
attempts++
|
||||||
}
|
}
|
||||||
// wait until the delay elapses or the context is cancelled
|
// wait until the delay elapses or the context is cancelled
|
||||||
delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, ctx.Done())
|
delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, cancelCtx.Done())
|
||||||
if !delayElapsed {
|
if !delayElapsed {
|
||||||
return autorest.NewErrorWithError(ctx.Err(), "Future", "WaitForCompletion", f.pt.latestResponse(), "context has been cancelled")
|
return autorest.NewErrorWithError(cancelCtx.Err(), "Future", "WaitForCompletion", f.pt.latestResponse(), "context has been cancelled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements the json.Marshaler interface.
|
// MarshalJSON implements the json.Marshaler interface.
|
||||||
|
@ -285,7 +319,7 @@ type pollingTracker interface {
|
||||||
initializeState() error
|
initializeState() error
|
||||||
|
|
||||||
// makes an HTTP request to check the status of the LRO
|
// makes an HTTP request to check the status of the LRO
|
||||||
pollForStatus(sender autorest.Sender) error
|
pollForStatus(ctx context.Context, sender autorest.Sender) error
|
||||||
|
|
||||||
// updates internal tracker state, call this after each call to pollForStatus
|
// updates internal tracker state, call this after each call to pollForStatus
|
||||||
updatePollingState(provStateApl bool) error
|
updatePollingState(provStateApl bool) error
|
||||||
|
@ -399,6 +433,10 @@ func (pt *pollingTrackerBase) updateRawBody() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to read response body")
|
return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to read response body")
|
||||||
}
|
}
|
||||||
|
// observed in 204 responses over HTTP/2.0; the content length is -1 but body is empty
|
||||||
|
if len(b) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
// put the body back so it's available to other callers
|
// put the body back so it's available to other callers
|
||||||
pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b))
|
pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b))
|
||||||
if err = json.Unmarshal(b, &pt.rawBody); err != nil {
|
if err = json.Unmarshal(b, &pt.rawBody); err != nil {
|
||||||
|
@ -408,15 +446,13 @@ func (pt *pollingTrackerBase) updateRawBody() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pt *pollingTrackerBase) pollForStatus(sender autorest.Sender) error {
|
func (pt *pollingTrackerBase) pollForStatus(ctx context.Context, sender autorest.Sender) error {
|
||||||
req, err := http.NewRequest(http.MethodGet, pt.URI, nil)
|
req, err := http.NewRequest(http.MethodGet, pt.URI, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to create HTTP request")
|
return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to create HTTP request")
|
||||||
}
|
}
|
||||||
// attach the context from the original request if available (it will be absent for deserialized futures)
|
|
||||||
if pt.resp != nil {
|
req = req.WithContext(ctx)
|
||||||
req = req.WithContext(pt.resp.Request.Context())
|
|
||||||
}
|
|
||||||
pt.resp, err = sender.Do(req)
|
pt.resp, err = sender.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to send HTTP request")
|
return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to send HTTP request")
|
||||||
|
@ -428,6 +464,7 @@ func (pt *pollingTrackerBase) pollForStatus(sender autorest.Sender) error {
|
||||||
} else {
|
} else {
|
||||||
// check response body for error content
|
// check response body for error content
|
||||||
pt.updateErrorFromResponse()
|
pt.updateErrorFromResponse()
|
||||||
|
err = pt.pollingError()
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -444,7 +481,7 @@ func (pt *pollingTrackerBase) updateErrorFromResponse() {
|
||||||
re := respErr{}
|
re := respErr{}
|
||||||
defer pt.resp.Body.Close()
|
defer pt.resp.Body.Close()
|
||||||
var b []byte
|
var b []byte
|
||||||
if b, err = ioutil.ReadAll(pt.resp.Body); err != nil {
|
if b, err = ioutil.ReadAll(pt.resp.Body); err != nil || len(b) == 0 {
|
||||||
goto Default
|
goto Default
|
||||||
}
|
}
|
||||||
if err = json.Unmarshal(b, &re); err != nil {
|
if err = json.Unmarshal(b, &re); err != nil {
|
||||||
|
@ -662,7 +699,7 @@ func (pt *pollingTrackerPatch) updatePollingMethod() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary
|
// for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary
|
||||||
// note the absense of the "final GET" mechanism for PATCH
|
// note the absence of the "final GET" mechanism for PATCH
|
||||||
if pt.resp.StatusCode == http.StatusAccepted {
|
if pt.resp.StatusCode == http.StatusAccepted {
|
||||||
ao, err := getURLFromAsyncOpHeader(pt.resp)
|
ao, err := getURLFromAsyncOpHeader(pt.resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -793,8 +830,6 @@ func (pt *pollingTrackerPut) updatePollingMethod() error {
|
||||||
pt.URI = lh
|
pt.URI = lh
|
||||||
pt.Pm = PollingLocation
|
pt.Pm = PollingLocation
|
||||||
}
|
}
|
||||||
// when both headers are returned we use the value in the Location header for the final GET
|
|
||||||
pt.FinalGetURI = lh
|
|
||||||
}
|
}
|
||||||
// make sure a polling URL was found
|
// make sure a polling URL was found
|
||||||
if pt.URI == "" {
|
if pt.URI == "" {
|
||||||
|
|
6
vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
generated
vendored
6
vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
generated
vendored
|
@ -140,8 +140,8 @@ func register(client autorest.Client, originalReq *http.Request, re RequestError
|
||||||
}
|
}
|
||||||
|
|
||||||
// poll for registered provisioning state
|
// poll for registered provisioning state
|
||||||
now := time.Now()
|
registrationStartTime := time.Now()
|
||||||
for err == nil && time.Since(now) < client.PollingDuration {
|
for err == nil && (client.PollingDuration == 0 || (client.PollingDuration != 0 && time.Since(registrationStartTime) < client.PollingDuration)) {
|
||||||
// taken from the resources SDK
|
// taken from the resources SDK
|
||||||
// https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L45
|
// https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L45
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
|
@ -183,7 +183,7 @@ func register(client autorest.Client, originalReq *http.Request, re RequestError
|
||||||
return originalReq.Context().Err()
|
return originalReq.Context().Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !(time.Since(now) < client.PollingDuration) {
|
if client.PollingDuration != 0 && !(time.Since(registrationStartTime) < client.PollingDuration) {
|
||||||
return errors.New("polling for resource provider registration has exceeded the polling duration")
|
return errors.New("polling for resource provider registration has exceeded the polling duration")
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
9
vendor/github.com/Azure/go-autorest/autorest/client.go
generated
vendored
9
vendor/github.com/Azure/go-autorest/autorest/client.go
generated
vendored
|
@ -26,7 +26,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Azure/go-autorest/logger"
|
"github.com/Azure/go-autorest/logger"
|
||||||
"github.com/Azure/go-autorest/version"
|
"github.com/Azure/go-autorest/tracing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -147,6 +147,7 @@ type Client struct {
|
||||||
PollingDelay time.Duration
|
PollingDelay time.Duration
|
||||||
|
|
||||||
// PollingDuration sets the maximum polling time after which an error is returned.
|
// PollingDuration sets the maximum polling time after which an error is returned.
|
||||||
|
// Setting this to zero will use the provided context to control the duration.
|
||||||
PollingDuration time.Duration
|
PollingDuration time.Duration
|
||||||
|
|
||||||
// RetryAttempts sets the default number of retry attempts for client.
|
// RetryAttempts sets the default number of retry attempts for client.
|
||||||
|
@ -173,7 +174,7 @@ func NewClientWithUserAgent(ua string) Client {
|
||||||
PollingDuration: DefaultPollingDuration,
|
PollingDuration: DefaultPollingDuration,
|
||||||
RetryAttempts: DefaultRetryAttempts,
|
RetryAttempts: DefaultRetryAttempts,
|
||||||
RetryDuration: DefaultRetryDuration,
|
RetryDuration: DefaultRetryDuration,
|
||||||
UserAgent: version.UserAgent(),
|
UserAgent: UserAgent(),
|
||||||
}
|
}
|
||||||
c.Sender = c.sender()
|
c.Sender = c.sender()
|
||||||
c.AddToUserAgent(ua)
|
c.AddToUserAgent(ua)
|
||||||
|
@ -229,8 +230,10 @@ func (c Client) Do(r *http.Request) (*http.Response, error) {
|
||||||
func (c Client) sender() Sender {
|
func (c Client) sender() Sender {
|
||||||
if c.Sender == nil {
|
if c.Sender == nil {
|
||||||
j, _ := cookiejar.New(nil)
|
j, _ := cookiejar.New(nil)
|
||||||
return &http.Client{Jar: j}
|
client := &http.Client{Jar: j, Transport: tracing.Transport}
|
||||||
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.Sender
|
return c.Sender
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
vendor/github.com/Azure/go-autorest/autorest/sender.go
generated
vendored
11
vendor/github.com/Azure/go-autorest/autorest/sender.go
generated
vendored
|
@ -21,6 +21,8 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Azure/go-autorest/tracing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sender is the interface that wraps the Do method to send HTTP requests.
|
// Sender is the interface that wraps the Do method to send HTTP requests.
|
||||||
|
@ -38,7 +40,7 @@ func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) {
|
||||||
return sf(r)
|
return sf(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the
|
// SendDecorator takes and possibly decorates, by wrapping, a Sender. Decorators may affect the
|
||||||
// http.Request and pass it along or, first, pass the http.Request along then react to the
|
// http.Request and pass it along or, first, pass the http.Request along then react to the
|
||||||
// http.Response result.
|
// http.Response result.
|
||||||
type SendDecorator func(Sender) Sender
|
type SendDecorator func(Sender) Sender
|
||||||
|
@ -68,7 +70,7 @@ func DecorateSender(s Sender, decorators ...SendDecorator) Sender {
|
||||||
//
|
//
|
||||||
// Send will not poll or retry requests.
|
// Send will not poll or retry requests.
|
||||||
func Send(r *http.Request, decorators ...SendDecorator) (*http.Response, error) {
|
func Send(r *http.Request, decorators ...SendDecorator) (*http.Response, error) {
|
||||||
return SendWithSender(&http.Client{}, r, decorators...)
|
return SendWithSender(&http.Client{Transport: tracing.Transport}, r, decorators...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendWithSender sends the passed http.Request, through the provided Sender, returning the
|
// SendWithSender sends the passed http.Request, through the provided Sender, returning the
|
||||||
|
@ -216,8 +218,7 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se
|
||||||
return SenderFunc(func(r *http.Request) (resp *http.Response, err error) {
|
return SenderFunc(func(r *http.Request) (resp *http.Response, err error) {
|
||||||
rr := NewRetriableRequest(r)
|
rr := NewRetriableRequest(r)
|
||||||
// Increment to add the first call (attempts denotes number of retries)
|
// Increment to add the first call (attempts denotes number of retries)
|
||||||
attempts++
|
for attempt := 0; attempt < attempts+1; {
|
||||||
for attempt := 0; attempt < attempts; {
|
|
||||||
err = rr.Prepare()
|
err = rr.Prepare()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, err
|
return resp, err
|
||||||
|
@ -234,7 +235,7 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se
|
||||||
}
|
}
|
||||||
delayed := DelayWithRetryAfter(resp, r.Context().Done())
|
delayed := DelayWithRetryAfter(resp, r.Context().Done())
|
||||||
if !delayed && !DelayForBackoff(backoff, attempt, r.Context().Done()) {
|
if !delayed && !DelayForBackoff(backoff, attempt, r.Context().Done()) {
|
||||||
return nil, r.Context().Err()
|
return resp, r.Context().Err()
|
||||||
}
|
}
|
||||||
// don't count a 429 against the number of attempts
|
// don't count a 429 against the number of attempts
|
||||||
// so that we continue to retry until it succeeds
|
// so that we continue to retry until it succeeds
|
||||||
|
|
2
vendor/github.com/Azure/go-autorest/autorest/utility.go
generated
vendored
2
vendor/github.com/Azure/go-autorest/autorest/utility.go
generated
vendored
|
@ -157,7 +157,7 @@ func AsStringSlice(s interface{}) ([]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// String method converts interface v to string. If interface is a list, it
|
// String method converts interface v to string. If interface is a list, it
|
||||||
// joins list elements using the seperator. Note that only sep[0] will be used for
|
// joins list elements using the separator. Note that only sep[0] will be used for
|
||||||
// joining if any separator is specified.
|
// joining if any separator is specified.
|
||||||
func String(v interface{}, sep ...string) string {
|
func String(v interface{}, sep ...string) string {
|
||||||
if len(sep) == 0 {
|
if len(sep) == 0 {
|
||||||
|
|
25
vendor/github.com/Azure/go-autorest/autorest/version.go
generated
vendored
25
vendor/github.com/Azure/go-autorest/autorest/version.go
generated
vendored
|
@ -1,7 +1,5 @@
|
||||||
package autorest
|
package autorest
|
||||||
|
|
||||||
import "github.com/Azure/go-autorest/version"
|
|
||||||
|
|
||||||
// Copyright 2017 Microsoft Corporation
|
// Copyright 2017 Microsoft Corporation
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -16,7 +14,28 @@ import "github.com/Azure/go-autorest/version"
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
const number = "v11.4.0"
|
||||||
|
|
||||||
|
var (
|
||||||
|
userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s",
|
||||||
|
runtime.Version(),
|
||||||
|
runtime.GOARCH,
|
||||||
|
runtime.GOOS,
|
||||||
|
number,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserAgent returns a string containing the Go version, system architecture and OS, and the go-autorest version.
|
||||||
|
func UserAgent() string {
|
||||||
|
return userAgent
|
||||||
|
}
|
||||||
|
|
||||||
// Version returns the semantic version (see http://semver.org).
|
// Version returns the semantic version (see http://semver.org).
|
||||||
func Version() string {
|
func Version() string {
|
||||||
return version.Number
|
return number
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/Azure/go-autorest/logger/logger.go
generated
vendored
4
vendor/github.com/Azure/go-autorest/logger/logger.go
generated
vendored
|
@ -162,7 +162,7 @@ type Writer interface {
|
||||||
// WriteResponse writes the specified HTTP response to the logger if the log level is greater than
|
// WriteResponse writes the specified HTTP response to the logger if the log level is greater than
|
||||||
// or equal to LogInfo. The response body, if set, is logged at level LogDebug or higher.
|
// or equal to LogInfo. The response body, if set, is logged at level LogDebug or higher.
|
||||||
// Custom filters can be specified to exclude URL, header, and/or body content from the log.
|
// Custom filters can be specified to exclude URL, header, and/or body content from the log.
|
||||||
// By default no respone content is excluded.
|
// By default no response content is excluded.
|
||||||
WriteResponse(resp *http.Response, filter Filter)
|
WriteResponse(resp *http.Response, filter Filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ func (fl fileLogger) WriteResponse(resp *http.Response, filter Filter) {
|
||||||
// returns true if the provided body should be included in the log
|
// returns true if the provided body should be included in the log
|
||||||
func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool {
|
func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool {
|
||||||
ct := header.Get("Content-Type")
|
ct := header.Get("Content-Type")
|
||||||
return fl.logLevel >= LogDebug && body != nil && strings.Index(ct, "application/octet-stream") == -1
|
return fl.logLevel >= LogDebug && body != nil && !strings.Contains(ct, "application/octet-stream")
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates standard header for log entries, it contains a timestamp and the log level
|
// creates standard header for log entries, it contains a timestamp and the log level
|
||||||
|
|
190
vendor/github.com/Azure/go-autorest/tracing/tracing.go
generated
vendored
Normal file
190
vendor/github.com/Azure/go-autorest/tracing/tracing.go
generated
vendored
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
package tracing
|
||||||
|
|
||||||
|
// Copyright 2018 Microsoft Corporation
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"contrib.go.opencensus.io/exporter/ocagent"
|
||||||
|
"go.opencensus.io/plugin/ochttp"
|
||||||
|
"go.opencensus.io/plugin/ochttp/propagation/tracecontext"
|
||||||
|
"go.opencensus.io/stats/view"
|
||||||
|
"go.opencensus.io/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Transport is the default tracing RoundTripper. The custom options setter will control
|
||||||
|
// if traces are being emitted or not.
|
||||||
|
Transport = &ochttp.Transport{
|
||||||
|
Propagation: &tracecontext.HTTPFormat{},
|
||||||
|
GetStartOptions: getStartOptions,
|
||||||
|
}
|
||||||
|
|
||||||
|
// enabled is the flag for marking if tracing is enabled.
|
||||||
|
enabled = false
|
||||||
|
|
||||||
|
// Sampler is the tracing sampler. If tracing is disabled it will never sample. Otherwise
|
||||||
|
// it will be using the parent sampler or the default.
|
||||||
|
sampler = trace.NeverSample()
|
||||||
|
|
||||||
|
// Views for metric instrumentation.
|
||||||
|
views = map[string]*view.View{}
|
||||||
|
|
||||||
|
// the trace exporter
|
||||||
|
traceExporter trace.Exporter
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
enableFromEnv()
|
||||||
|
}
|
||||||
|
|
||||||
|
func enableFromEnv() {
|
||||||
|
_, ok := os.LookupEnv("AZURE_SDK_TRACING_ENABLED")
|
||||||
|
_, legacyOk := os.LookupEnv("AZURE_SDK_TRACING_ENABELD")
|
||||||
|
if ok || legacyOk {
|
||||||
|
agentEndpoint, ok := os.LookupEnv("OCAGENT_TRACE_EXPORTER_ENDPOINT")
|
||||||
|
|
||||||
|
if ok {
|
||||||
|
EnableWithAIForwarding(agentEndpoint)
|
||||||
|
} else {
|
||||||
|
Enable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsEnabled returns true if monitoring is enabled for the sdk.
|
||||||
|
func IsEnabled() bool {
|
||||||
|
return enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable will start instrumentation for metrics and traces.
|
||||||
|
func Enable() error {
|
||||||
|
enabled = true
|
||||||
|
sampler = nil
|
||||||
|
|
||||||
|
err := initStats()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable will disable instrumentation for metrics and traces.
|
||||||
|
func Disable() {
|
||||||
|
disableStats()
|
||||||
|
sampler = trace.NeverSample()
|
||||||
|
if traceExporter != nil {
|
||||||
|
trace.UnregisterExporter(traceExporter)
|
||||||
|
}
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnableWithAIForwarding will start instrumentation and will connect to app insights forwarder
|
||||||
|
// exporter making the metrics and traces available in app insights.
|
||||||
|
func EnableWithAIForwarding(agentEndpoint string) (err error) {
|
||||||
|
err = Enable()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
traceExporter, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(agentEndpoint))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
trace.RegisterExporter(traceExporter)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// getStartOptions is the custom options setter for the ochttp package.
|
||||||
|
func getStartOptions(*http.Request) trace.StartOptions {
|
||||||
|
return trace.StartOptions{
|
||||||
|
Sampler: sampler,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// initStats registers the views for the http metrics
|
||||||
|
func initStats() (err error) {
|
||||||
|
clientViews := []*view.View{
|
||||||
|
ochttp.ClientCompletedCount,
|
||||||
|
ochttp.ClientRoundtripLatencyDistribution,
|
||||||
|
ochttp.ClientReceivedBytesDistribution,
|
||||||
|
ochttp.ClientSentBytesDistribution,
|
||||||
|
}
|
||||||
|
for _, cv := range clientViews {
|
||||||
|
vn := fmt.Sprintf("Azure/go-autorest/tracing-%s", cv.Name)
|
||||||
|
views[vn] = cv.WithName(vn)
|
||||||
|
err = view.Register(views[vn])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// disableStats will unregister the previously registered metrics
|
||||||
|
func disableStats() {
|
||||||
|
for _, v := range views {
|
||||||
|
view.Unregister(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartSpan starts a trace span
|
||||||
|
func StartSpan(ctx context.Context, name string) context.Context {
|
||||||
|
ctx, _ = trace.StartSpan(ctx, name, trace.WithSampler(sampler))
|
||||||
|
return ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// EndSpan ends a previously started span stored in the context
|
||||||
|
func EndSpan(ctx context.Context, httpStatusCode int, err error) {
|
||||||
|
span := trace.FromContext(ctx)
|
||||||
|
|
||||||
|
if span == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
span.SetStatus(trace.Status{Message: err.Error(), Code: toTraceStatusCode(httpStatusCode)})
|
||||||
|
}
|
||||||
|
span.End()
|
||||||
|
}
|
||||||
|
|
||||||
|
// toTraceStatusCode converts HTTP Codes to OpenCensus codes as defined
|
||||||
|
// at https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#status
|
||||||
|
func toTraceStatusCode(httpStatusCode int) int32 {
|
||||||
|
switch {
|
||||||
|
case http.StatusOK <= httpStatusCode && httpStatusCode < http.StatusBadRequest:
|
||||||
|
return trace.StatusCodeOK
|
||||||
|
case httpStatusCode == http.StatusBadRequest:
|
||||||
|
return trace.StatusCodeInvalidArgument
|
||||||
|
case httpStatusCode == http.StatusUnauthorized: // 401 is actually unauthenticated.
|
||||||
|
return trace.StatusCodeUnauthenticated
|
||||||
|
case httpStatusCode == http.StatusForbidden:
|
||||||
|
return trace.StatusCodePermissionDenied
|
||||||
|
case httpStatusCode == http.StatusNotFound:
|
||||||
|
return trace.StatusCodeNotFound
|
||||||
|
case httpStatusCode == http.StatusTooManyRequests:
|
||||||
|
return trace.StatusCodeResourceExhausted
|
||||||
|
case httpStatusCode == 499:
|
||||||
|
return trace.StatusCodeCancelled
|
||||||
|
case httpStatusCode == http.StatusNotImplemented:
|
||||||
|
return trace.StatusCodeUnimplemented
|
||||||
|
case httpStatusCode == http.StatusServiceUnavailable:
|
||||||
|
return trace.StatusCodeUnavailable
|
||||||
|
case httpStatusCode == http.StatusGatewayTimeout:
|
||||||
|
return trace.StatusCodeDeadlineExceeded
|
||||||
|
default:
|
||||||
|
return trace.StatusCodeUnknown
|
||||||
|
}
|
||||||
|
}
|
2
vendor/github.com/cenkalti/backoff/.travis.yml
generated
vendored
2
vendor/github.com/cenkalti/backoff/.travis.yml
generated
vendored
|
@ -1,6 +1,6 @@
|
||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- 1.3.3
|
- 1.7
|
||||||
- 1.x
|
- 1.x
|
||||||
- tip
|
- tip
|
||||||
before_install:
|
before_install:
|
||||||
|
|
2
vendor/github.com/cenkalti/backoff/README.md
generated
vendored
2
vendor/github.com/cenkalti/backoff/README.md
generated
vendored
|
@ -24,7 +24,7 @@ See https://godoc.org/github.com/cenkalti/backoff#pkg-examples
|
||||||
[coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master
|
[coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master
|
||||||
[coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master
|
[coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master
|
||||||
|
|
||||||
[google-http-java-client]: https://github.com/google/google-http-java-client
|
[google-http-java-client]: https://github.com/google/google-http-java-client/blob/da1aa993e90285ec18579f1553339b00e19b3ab5/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java
|
||||||
[exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff
|
[exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff
|
||||||
|
|
||||||
[advanced example]: https://godoc.org/github.com/cenkalti/backoff#example_
|
[advanced example]: https://godoc.org/github.com/cenkalti/backoff#example_
|
||||||
|
|
11
vendor/github.com/cenkalti/backoff/context.go
generated
vendored
11
vendor/github.com/cenkalti/backoff/context.go
generated
vendored
|
@ -1,9 +1,8 @@
|
||||||
package backoff
|
package backoff
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BackOffContext is a backoff policy that stops retrying after the context
|
// BackOffContext is a backoff policy that stops retrying after the context
|
||||||
|
@ -52,9 +51,13 @@ func (b *backOffContext) Context() context.Context {
|
||||||
|
|
||||||
func (b *backOffContext) NextBackOff() time.Duration {
|
func (b *backOffContext) NextBackOff() time.Duration {
|
||||||
select {
|
select {
|
||||||
case <-b.Context().Done():
|
case <-b.ctx.Done():
|
||||||
return Stop
|
return Stop
|
||||||
default:
|
default:
|
||||||
return b.BackOff.NextBackOff()
|
|
||||||
}
|
}
|
||||||
|
next := b.BackOff.NextBackOff()
|
||||||
|
if deadline, ok := b.ctx.Deadline(); ok && deadline.Sub(time.Now()) < next {
|
||||||
|
return Stop
|
||||||
|
}
|
||||||
|
return next
|
||||||
}
|
}
|
||||||
|
|
7
vendor/github.com/cenkalti/backoff/exponential.go
generated
vendored
7
vendor/github.com/cenkalti/backoff/exponential.go
generated
vendored
|
@ -63,7 +63,6 @@ type ExponentialBackOff struct {
|
||||||
|
|
||||||
currentInterval time.Duration
|
currentInterval time.Duration
|
||||||
startTime time.Time
|
startTime time.Time
|
||||||
random *rand.Rand
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clock is an interface that returns current time for BackOff.
|
// Clock is an interface that returns current time for BackOff.
|
||||||
|
@ -89,7 +88,6 @@ func NewExponentialBackOff() *ExponentialBackOff {
|
||||||
MaxInterval: DefaultMaxInterval,
|
MaxInterval: DefaultMaxInterval,
|
||||||
MaxElapsedTime: DefaultMaxElapsedTime,
|
MaxElapsedTime: DefaultMaxElapsedTime,
|
||||||
Clock: SystemClock,
|
Clock: SystemClock,
|
||||||
random: rand.New(rand.NewSource(time.Now().UnixNano())),
|
|
||||||
}
|
}
|
||||||
b.Reset()
|
b.Reset()
|
||||||
return b
|
return b
|
||||||
|
@ -118,10 +116,7 @@ func (b *ExponentialBackOff) NextBackOff() time.Duration {
|
||||||
return Stop
|
return Stop
|
||||||
}
|
}
|
||||||
defer b.incrementCurrentInterval()
|
defer b.incrementCurrentInterval()
|
||||||
if b.random == nil {
|
return getRandomValueFromInterval(b.RandomizationFactor, rand.Float64(), b.currentInterval)
|
||||||
b.random = rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
||||||
}
|
|
||||||
return getRandomValueFromInterval(b.RandomizationFactor, b.random.Float64(), b.currentInterval)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetElapsedTime returns the elapsed time since an ExponentialBackOff instance
|
// GetElapsedTime returns the elapsed time since an ExponentialBackOff instance
|
||||||
|
|
12
vendor/github.com/cenkalti/backoff/retry.go
generated
vendored
12
vendor/github.com/cenkalti/backoff/retry.go
generated
vendored
|
@ -15,7 +15,6 @@ type Notify func(error, time.Duration)
|
||||||
|
|
||||||
// Retry the operation o until it does not return error or BackOff stops.
|
// Retry the operation o until it does not return error or BackOff stops.
|
||||||
// o is guaranteed to be run at least once.
|
// o is guaranteed to be run at least once.
|
||||||
// It is the caller's responsibility to reset b after Retry returns.
|
|
||||||
//
|
//
|
||||||
// If o returns a *PermanentError, the operation is not retried, and the
|
// If o returns a *PermanentError, the operation is not retried, and the
|
||||||
// wrapped error is returned.
|
// wrapped error is returned.
|
||||||
|
@ -29,6 +28,7 @@ func Retry(o Operation, b BackOff) error { return RetryNotify(o, b, nil) }
|
||||||
func RetryNotify(operation Operation, b BackOff, notify Notify) error {
|
func RetryNotify(operation Operation, b BackOff, notify Notify) error {
|
||||||
var err error
|
var err error
|
||||||
var next time.Duration
|
var next time.Duration
|
||||||
|
var t *time.Timer
|
||||||
|
|
||||||
cb := ensureContext(b)
|
cb := ensureContext(b)
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ func RetryNotify(operation Operation, b BackOff, notify Notify) error {
|
||||||
return permanent.Err
|
return permanent.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
if next = b.NextBackOff(); next == Stop {
|
if next = cb.NextBackOff(); next == Stop {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,15 @@ func RetryNotify(operation Operation, b BackOff, notify Notify) error {
|
||||||
notify(err, next)
|
notify(err, next)
|
||||||
}
|
}
|
||||||
|
|
||||||
t := time.NewTimer(next)
|
if t == nil {
|
||||||
|
t = time.NewTimer(next)
|
||||||
|
defer t.Stop()
|
||||||
|
} else {
|
||||||
|
t.Reset(next)
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-cb.Context().Done():
|
case <-cb.Context().Done():
|
||||||
t.Stop()
|
|
||||||
return err
|
return err
|
||||||
case <-t.C:
|
case <-t.C:
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/cenkalti/backoff/ticker.go
generated
vendored
2
vendor/github.com/cenkalti/backoff/ticker.go
generated
vendored
|
@ -1,7 +1,6 @@
|
||||||
package backoff
|
package backoff
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -34,7 +33,6 @@ func NewTicker(b BackOff) *Ticker {
|
||||||
}
|
}
|
||||||
t.b.Reset()
|
t.b.Reset()
|
||||||
go t.run()
|
go t.run()
|
||||||
runtime.SetFinalizer(t, (*Ticker).Stop)
|
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
vendor/github.com/census-instrumentation/opencensus-proto/AUTHORS
generated
vendored
Normal file
1
vendor/github.com/census-instrumentation/opencensus-proto/AUTHORS
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Google Inc.
|
202
vendor/github.com/census-instrumentation/opencensus-proto/LICENSE
generated
vendored
Normal file
202
vendor/github.com/census-instrumentation/opencensus-proto/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
348
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go
generated
vendored
Normal file
348
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,348 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: opencensus/proto/agent/common/v1/common.proto
|
||||||
|
|
||||||
|
package v1 // import "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
import timestamp "github.com/golang/protobuf/ptypes/timestamp"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
type LibraryInfo_Language int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
LibraryInfo_LANGUAGE_UNSPECIFIED LibraryInfo_Language = 0
|
||||||
|
LibraryInfo_CPP LibraryInfo_Language = 1
|
||||||
|
LibraryInfo_C_SHARP LibraryInfo_Language = 2
|
||||||
|
LibraryInfo_ERLANG LibraryInfo_Language = 3
|
||||||
|
LibraryInfo_GO_LANG LibraryInfo_Language = 4
|
||||||
|
LibraryInfo_JAVA LibraryInfo_Language = 5
|
||||||
|
LibraryInfo_NODE_JS LibraryInfo_Language = 6
|
||||||
|
LibraryInfo_PHP LibraryInfo_Language = 7
|
||||||
|
LibraryInfo_PYTHON LibraryInfo_Language = 8
|
||||||
|
LibraryInfo_RUBY LibraryInfo_Language = 9
|
||||||
|
)
|
||||||
|
|
||||||
|
var LibraryInfo_Language_name = map[int32]string{
|
||||||
|
0: "LANGUAGE_UNSPECIFIED",
|
||||||
|
1: "CPP",
|
||||||
|
2: "C_SHARP",
|
||||||
|
3: "ERLANG",
|
||||||
|
4: "GO_LANG",
|
||||||
|
5: "JAVA",
|
||||||
|
6: "NODE_JS",
|
||||||
|
7: "PHP",
|
||||||
|
8: "PYTHON",
|
||||||
|
9: "RUBY",
|
||||||
|
}
|
||||||
|
var LibraryInfo_Language_value = map[string]int32{
|
||||||
|
"LANGUAGE_UNSPECIFIED": 0,
|
||||||
|
"CPP": 1,
|
||||||
|
"C_SHARP": 2,
|
||||||
|
"ERLANG": 3,
|
||||||
|
"GO_LANG": 4,
|
||||||
|
"JAVA": 5,
|
||||||
|
"NODE_JS": 6,
|
||||||
|
"PHP": 7,
|
||||||
|
"PYTHON": 8,
|
||||||
|
"RUBY": 9,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x LibraryInfo_Language) String() string {
|
||||||
|
return proto.EnumName(LibraryInfo_Language_name, int32(x))
|
||||||
|
}
|
||||||
|
func (LibraryInfo_Language) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_common_5e0eaac3929d3455, []int{2, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identifier metadata of the Node (Application instrumented with OpenCensus)
|
||||||
|
// that connects to OpenCensus Agent.
|
||||||
|
// In the future we plan to extend the identifier proto definition to support
|
||||||
|
// additional information (e.g cloud id, etc.)
|
||||||
|
type Node struct {
|
||||||
|
// Identifier that uniquely identifies a process within a VM/container.
|
||||||
|
Identifier *ProcessIdentifier `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
|
||||||
|
// Information on the OpenCensus Library that initiates the stream.
|
||||||
|
LibraryInfo *LibraryInfo `protobuf:"bytes,2,opt,name=library_info,json=libraryInfo,proto3" json:"library_info,omitempty"`
|
||||||
|
// Additional information on service.
|
||||||
|
ServiceInfo *ServiceInfo `protobuf:"bytes,3,opt,name=service_info,json=serviceInfo,proto3" json:"service_info,omitempty"`
|
||||||
|
// Additional attributes.
|
||||||
|
Attributes map[string]string `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Node) Reset() { *m = Node{} }
|
||||||
|
func (m *Node) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Node) ProtoMessage() {}
|
||||||
|
func (*Node) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_common_5e0eaac3929d3455, []int{0}
|
||||||
|
}
|
||||||
|
func (m *Node) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Node.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Node.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Node) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Node.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Node) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Node.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Node) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Node.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Node proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Node) GetIdentifier() *ProcessIdentifier {
|
||||||
|
if m != nil {
|
||||||
|
return m.Identifier
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Node) GetLibraryInfo() *LibraryInfo {
|
||||||
|
if m != nil {
|
||||||
|
return m.LibraryInfo
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Node) GetServiceInfo() *ServiceInfo {
|
||||||
|
if m != nil {
|
||||||
|
return m.ServiceInfo
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Node) GetAttributes() map[string]string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Attributes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identifier that uniquely identifies a process within a VM/container.
|
||||||
|
type ProcessIdentifier struct {
|
||||||
|
// The host name. Usually refers to the machine/container name.
|
||||||
|
// For example: os.Hostname() in Go, socket.gethostname() in Python.
|
||||||
|
HostName string `protobuf:"bytes,1,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"`
|
||||||
|
// Process id.
|
||||||
|
Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||||
|
// Start time of this ProcessIdentifier. Represented in epoch time.
|
||||||
|
StartTimestamp *timestamp.Timestamp `protobuf:"bytes,3,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ProcessIdentifier) Reset() { *m = ProcessIdentifier{} }
|
||||||
|
func (m *ProcessIdentifier) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ProcessIdentifier) ProtoMessage() {}
|
||||||
|
func (*ProcessIdentifier) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_common_5e0eaac3929d3455, []int{1}
|
||||||
|
}
|
||||||
|
func (m *ProcessIdentifier) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ProcessIdentifier.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ProcessIdentifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ProcessIdentifier.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ProcessIdentifier) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ProcessIdentifier.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ProcessIdentifier) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ProcessIdentifier.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ProcessIdentifier) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ProcessIdentifier.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ProcessIdentifier proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ProcessIdentifier) GetHostName() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.HostName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ProcessIdentifier) GetPid() uint32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Pid
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ProcessIdentifier) GetStartTimestamp() *timestamp.Timestamp {
|
||||||
|
if m != nil {
|
||||||
|
return m.StartTimestamp
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Information on OpenCensus Library.
|
||||||
|
type LibraryInfo struct {
|
||||||
|
// Language of OpenCensus Library.
|
||||||
|
Language LibraryInfo_Language `protobuf:"varint,1,opt,name=language,proto3,enum=opencensus.proto.agent.common.v1.LibraryInfo_Language" json:"language,omitempty"`
|
||||||
|
// Version of Agent exporter of Library.
|
||||||
|
ExporterVersion string `protobuf:"bytes,2,opt,name=exporter_version,json=exporterVersion,proto3" json:"exporter_version,omitempty"`
|
||||||
|
// Version of OpenCensus Library.
|
||||||
|
CoreLibraryVersion string `protobuf:"bytes,3,opt,name=core_library_version,json=coreLibraryVersion,proto3" json:"core_library_version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *LibraryInfo) Reset() { *m = LibraryInfo{} }
|
||||||
|
func (m *LibraryInfo) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*LibraryInfo) ProtoMessage() {}
|
||||||
|
func (*LibraryInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_common_5e0eaac3929d3455, []int{2}
|
||||||
|
}
|
||||||
|
func (m *LibraryInfo) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_LibraryInfo.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *LibraryInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_LibraryInfo.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *LibraryInfo) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_LibraryInfo.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *LibraryInfo) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_LibraryInfo.Size(m)
|
||||||
|
}
|
||||||
|
func (m *LibraryInfo) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_LibraryInfo.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_LibraryInfo proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *LibraryInfo) GetLanguage() LibraryInfo_Language {
|
||||||
|
if m != nil {
|
||||||
|
return m.Language
|
||||||
|
}
|
||||||
|
return LibraryInfo_LANGUAGE_UNSPECIFIED
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *LibraryInfo) GetExporterVersion() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ExporterVersion
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *LibraryInfo) GetCoreLibraryVersion() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.CoreLibraryVersion
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional service information.
|
||||||
|
type ServiceInfo struct {
|
||||||
|
// Name of the service.
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ServiceInfo) Reset() { *m = ServiceInfo{} }
|
||||||
|
func (m *ServiceInfo) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ServiceInfo) ProtoMessage() {}
|
||||||
|
func (*ServiceInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_common_5e0eaac3929d3455, []int{3}
|
||||||
|
}
|
||||||
|
func (m *ServiceInfo) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ServiceInfo.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ServiceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ServiceInfo.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ServiceInfo) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ServiceInfo.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ServiceInfo) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ServiceInfo.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ServiceInfo) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ServiceInfo.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ServiceInfo proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ServiceInfo) GetName() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*Node)(nil), "opencensus.proto.agent.common.v1.Node")
|
||||||
|
proto.RegisterMapType((map[string]string)(nil), "opencensus.proto.agent.common.v1.Node.AttributesEntry")
|
||||||
|
proto.RegisterType((*ProcessIdentifier)(nil), "opencensus.proto.agent.common.v1.ProcessIdentifier")
|
||||||
|
proto.RegisterType((*LibraryInfo)(nil), "opencensus.proto.agent.common.v1.LibraryInfo")
|
||||||
|
proto.RegisterType((*ServiceInfo)(nil), "opencensus.proto.agent.common.v1.ServiceInfo")
|
||||||
|
proto.RegisterEnum("opencensus.proto.agent.common.v1.LibraryInfo_Language", LibraryInfo_Language_name, LibraryInfo_Language_value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("opencensus/proto/agent/common/v1/common.proto", fileDescriptor_common_5e0eaac3929d3455)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_common_5e0eaac3929d3455 = []byte{
|
||||||
|
// 590 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x4f, 0xdb, 0x3e,
|
||||||
|
0x1c, 0xc6, 0x7f, 0x69, 0x0a, 0xb4, 0xdf, 0xfc, 0x06, 0x99, 0xc5, 0xa1, 0x62, 0x87, 0xb1, 0xee,
|
||||||
|
0xc2, 0x0e, 0x4d, 0x06, 0x48, 0xd3, 0x34, 0x69, 0x87, 0x52, 0x3a, 0x28, 0x42, 0x25, 0x72, 0x01,
|
||||||
|
0x89, 0x5d, 0xa2, 0xb4, 0xb8, 0xc1, 0x5a, 0x63, 0x57, 0xb6, 0x53, 0x8d, 0xd3, 0x8e, 0xd3, 0xde,
|
||||||
|
0xc0, 0x5e, 0xd4, 0x5e, 0xd5, 0x64, 0x3b, 0x69, 0xa3, 0x71, 0x28, 0xb7, 0xef, 0x9f, 0xe7, 0xf9,
|
||||||
|
0x38, 0x7a, 0x6c, 0x05, 0x3a, 0x7c, 0x4e, 0xd8, 0x84, 0x30, 0x99, 0xcb, 0x70, 0x2e, 0xb8, 0xe2,
|
||||||
|
0x61, 0x92, 0x12, 0xa6, 0xc2, 0x09, 0xcf, 0x32, 0xce, 0xc2, 0xc5, 0x61, 0x51, 0x05, 0x66, 0x89,
|
||||||
|
0xf6, 0x57, 0x72, 0x3b, 0x09, 0x8c, 0x3c, 0x28, 0x44, 0x8b, 0xc3, 0xbd, 0xd7, 0x29, 0xe7, 0xe9,
|
||||||
|
0x8c, 0x58, 0xd8, 0x38, 0x9f, 0x86, 0x8a, 0x66, 0x44, 0xaa, 0x24, 0x9b, 0x5b, 0x43, 0xfb, 0xb7,
|
||||||
|
0x0b, 0xf5, 0x21, 0xbf, 0x27, 0x68, 0x04, 0x40, 0xef, 0x09, 0x53, 0x74, 0x4a, 0x89, 0x68, 0x39,
|
||||||
|
0xfb, 0xce, 0x81, 0x77, 0x74, 0x1c, 0xac, 0x3b, 0x20, 0x88, 0x04, 0x9f, 0x10, 0x29, 0x07, 0x4b,
|
||||||
|
0x2b, 0xae, 0x60, 0x50, 0x04, 0xff, 0xcf, 0xe8, 0x58, 0x24, 0xe2, 0x31, 0xa6, 0x6c, 0xca, 0x5b,
|
||||||
|
0x35, 0x83, 0xed, 0xac, 0xc7, 0x5e, 0x5a, 0xd7, 0x80, 0x4d, 0x39, 0xf6, 0x66, 0xab, 0x46, 0x13,
|
||||||
|
0x25, 0x11, 0x0b, 0x3a, 0x21, 0x96, 0xe8, 0x3e, 0x97, 0x38, 0xb2, 0x2e, 0x4b, 0x94, 0xab, 0x06,
|
||||||
|
0xdd, 0x02, 0x24, 0x4a, 0x09, 0x3a, 0xce, 0x15, 0x91, 0xad, 0xfa, 0xbe, 0x7b, 0xe0, 0x1d, 0x7d,
|
||||||
|
0x58, 0xcf, 0xd3, 0xa1, 0x05, 0xdd, 0xa5, 0xb1, 0xcf, 0x94, 0x78, 0xc4, 0x15, 0xd2, 0xde, 0x67,
|
||||||
|
0xd8, 0xf9, 0x67, 0x8d, 0x7c, 0x70, 0xbf, 0x91, 0x47, 0x13, 0x6e, 0x13, 0xeb, 0x12, 0xed, 0xc2,
|
||||||
|
0xc6, 0x22, 0x99, 0xe5, 0xc4, 0x24, 0xd3, 0xc4, 0xb6, 0xf9, 0x54, 0xfb, 0xe8, 0xb4, 0x7f, 0x3a,
|
||||||
|
0xf0, 0xf2, 0x49, 0xb8, 0xe8, 0x15, 0x34, 0x1f, 0xb8, 0x54, 0x31, 0x4b, 0x32, 0x52, 0x70, 0x1a,
|
||||||
|
0x7a, 0x30, 0x4c, 0x32, 0xa2, 0xf1, 0x73, 0x7a, 0x6f, 0x50, 0x2f, 0xb0, 0x2e, 0x51, 0x0f, 0x76,
|
||||||
|
0xa4, 0x4a, 0x84, 0x8a, 0x97, 0xd7, 0x5e, 0x04, 0xb6, 0x17, 0xd8, 0x87, 0x11, 0x94, 0x0f, 0x23,
|
||||||
|
0xb8, 0x2e, 0x15, 0x78, 0xdb, 0x58, 0x96, 0x7d, 0xfb, 0x4f, 0x0d, 0xbc, 0xca, 0x7d, 0x20, 0x0c,
|
||||||
|
0x8d, 0x59, 0xc2, 0xd2, 0x3c, 0x49, 0xed, 0x27, 0x6c, 0x3f, 0x27, 0xae, 0x0a, 0x20, 0xb8, 0x2c,
|
||||||
|
0xdc, 0x78, 0xc9, 0x41, 0xef, 0xc0, 0x27, 0xdf, 0xe7, 0x5c, 0x28, 0x22, 0xe2, 0x05, 0x11, 0x92,
|
||||||
|
0x72, 0x56, 0x44, 0xb2, 0x53, 0xce, 0x6f, 0xed, 0x18, 0xbd, 0x87, 0xdd, 0x09, 0x17, 0x24, 0x2e,
|
||||||
|
0x1f, 0x56, 0x29, 0x77, 0x8d, 0x1c, 0xe9, 0x5d, 0x71, 0x58, 0xe1, 0x68, 0xff, 0x72, 0xa0, 0x51,
|
||||||
|
0x9e, 0x89, 0x5a, 0xb0, 0x7b, 0xd9, 0x1d, 0x9e, 0xdd, 0x74, 0xcf, 0xfa, 0xf1, 0xcd, 0x70, 0x14,
|
||||||
|
0xf5, 0x7b, 0x83, 0x2f, 0x83, 0xfe, 0xa9, 0xff, 0x1f, 0xda, 0x02, 0xb7, 0x17, 0x45, 0xbe, 0x83,
|
||||||
|
0x3c, 0xd8, 0xea, 0xc5, 0xa3, 0xf3, 0x2e, 0x8e, 0xfc, 0x1a, 0x02, 0xd8, 0xec, 0x63, 0xed, 0xf0,
|
||||||
|
0x5d, 0xbd, 0x38, 0xbb, 0x8a, 0x4d, 0x53, 0x47, 0x0d, 0xa8, 0x5f, 0x74, 0x6f, 0xbb, 0xfe, 0x86,
|
||||||
|
0x1e, 0x0f, 0xaf, 0x4e, 0xfb, 0xf1, 0xc5, 0xc8, 0xdf, 0xd4, 0x94, 0xe8, 0x3c, 0xf2, 0xb7, 0xb4,
|
||||||
|
0x31, 0xba, 0xbb, 0x3e, 0xbf, 0x1a, 0xfa, 0x0d, 0xad, 0xc5, 0x37, 0x27, 0x77, 0x7e, 0xb3, 0xfd,
|
||||||
|
0x06, 0xbc, 0xca, 0x4b, 0x44, 0x08, 0xea, 0x95, 0xab, 0x34, 0xf5, 0xc9, 0x0f, 0x78, 0x4b, 0xf9,
|
||||||
|
0xda, 0x44, 0x4f, 0xbc, 0x9e, 0x29, 0x23, 0xbd, 0x8c, 0x9c, 0xaf, 0x83, 0x94, 0xaa, 0x87, 0x7c,
|
||||||
|
0xac, 0x05, 0xa1, 0xf5, 0x75, 0x28, 0x93, 0x4a, 0xe4, 0x19, 0x61, 0x2a, 0x51, 0x94, 0xb3, 0x70,
|
||||||
|
0x85, 0xec, 0xd8, 0x9f, 0x4b, 0x4a, 0x58, 0x27, 0x7d, 0xf2, 0x8f, 0x19, 0x6f, 0x9a, 0xed, 0xf1,
|
||||||
|
0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0xe5, 0x77, 0x76, 0x8e, 0x04, 0x00, 0x00,
|
||||||
|
}
|
263
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go
generated
vendored
Normal file
263
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,263 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: opencensus/proto/agent/metrics/v1/metrics_service.proto
|
||||||
|
|
||||||
|
package v1 // import "github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
import v1 "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
|
||||||
|
import v11 "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1"
|
||||||
|
import v12 "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1"
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "golang.org/x/net/context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
type ExportMetricsServiceRequest struct {
|
||||||
|
// This is required only in the first message on the stream or if the
|
||||||
|
// previous sent ExportMetricsServiceRequest message has a different Node (e.g.
|
||||||
|
// when the same RPC is used to send Metrics from multiple Applications).
|
||||||
|
Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
|
||||||
|
// A list of metrics that belong to the last received Node.
|
||||||
|
Metrics []*v11.Metric `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics,omitempty"`
|
||||||
|
// The resource for the metrics in this message that do not have an explicit
|
||||||
|
// resource set.
|
||||||
|
// If unset, the most recently set resource in the RPC stream applies. It is
|
||||||
|
// valid to never be set within a stream, e.g. when no resource info is known
|
||||||
|
// at all or when all sent metrics have an explicit resource set.
|
||||||
|
Resource *v12.Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportMetricsServiceRequest) Reset() { *m = ExportMetricsServiceRequest{} }
|
||||||
|
func (m *ExportMetricsServiceRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ExportMetricsServiceRequest) ProtoMessage() {}
|
||||||
|
func (*ExportMetricsServiceRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_metrics_service_0b252d64875a1756, []int{0}
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ExportMetricsServiceRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ExportMetricsServiceRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ExportMetricsServiceRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ExportMetricsServiceRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ExportMetricsServiceRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ExportMetricsServiceRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ExportMetricsServiceRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ExportMetricsServiceRequest) GetNode() *v1.Node {
|
||||||
|
if m != nil {
|
||||||
|
return m.Node
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportMetricsServiceRequest) GetMetrics() []*v11.Metric {
|
||||||
|
if m != nil {
|
||||||
|
return m.Metrics
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportMetricsServiceRequest) GetResource() *v12.Resource {
|
||||||
|
if m != nil {
|
||||||
|
return m.Resource
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExportMetricsServiceResponse struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportMetricsServiceResponse) Reset() { *m = ExportMetricsServiceResponse{} }
|
||||||
|
func (m *ExportMetricsServiceResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ExportMetricsServiceResponse) ProtoMessage() {}
|
||||||
|
func (*ExportMetricsServiceResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_metrics_service_0b252d64875a1756, []int{1}
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ExportMetricsServiceResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ExportMetricsServiceResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ExportMetricsServiceResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ExportMetricsServiceResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ExportMetricsServiceResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ExportMetricsServiceResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ExportMetricsServiceResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ExportMetricsServiceResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*ExportMetricsServiceRequest)(nil), "opencensus.proto.agent.metrics.v1.ExportMetricsServiceRequest")
|
||||||
|
proto.RegisterType((*ExportMetricsServiceResponse)(nil), "opencensus.proto.agent.metrics.v1.ExportMetricsServiceResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ context.Context
|
||||||
|
var _ grpc.ClientConn
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
|
// MetricsServiceClient is the client API for MetricsService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||||
|
type MetricsServiceClient interface {
|
||||||
|
// For performance reasons, it is recommended to keep this RPC
|
||||||
|
// alive for the entire life of the application.
|
||||||
|
Export(ctx context.Context, opts ...grpc.CallOption) (MetricsService_ExportClient, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type metricsServiceClient struct {
|
||||||
|
cc *grpc.ClientConn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient {
|
||||||
|
return &metricsServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *metricsServiceClient) Export(ctx context.Context, opts ...grpc.CallOption) (MetricsService_ExportClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &_MetricsService_serviceDesc.Streams[0], "/opencensus.proto.agent.metrics.v1.MetricsService/Export", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &metricsServiceExportClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type MetricsService_ExportClient interface {
|
||||||
|
Send(*ExportMetricsServiceRequest) error
|
||||||
|
Recv() (*ExportMetricsServiceResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type metricsServiceExportClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *metricsServiceExportClient) Send(m *ExportMetricsServiceRequest) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *metricsServiceExportClient) Recv() (*ExportMetricsServiceResponse, error) {
|
||||||
|
m := new(ExportMetricsServiceResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MetricsServiceServer is the server API for MetricsService service.
|
||||||
|
type MetricsServiceServer interface {
|
||||||
|
// For performance reasons, it is recommended to keep this RPC
|
||||||
|
// alive for the entire life of the application.
|
||||||
|
Export(MetricsService_ExportServer) error
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer) {
|
||||||
|
s.RegisterService(&_MetricsService_serviceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _MetricsService_Export_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(MetricsServiceServer).Export(&metricsServiceExportServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type MetricsService_ExportServer interface {
|
||||||
|
Send(*ExportMetricsServiceResponse) error
|
||||||
|
Recv() (*ExportMetricsServiceRequest, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type metricsServiceExportServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *metricsServiceExportServer) Send(m *ExportMetricsServiceResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *metricsServiceExportServer) Recv() (*ExportMetricsServiceRequest, error) {
|
||||||
|
m := new(ExportMetricsServiceRequest)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _MetricsService_serviceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "opencensus.proto.agent.metrics.v1.MetricsService",
|
||||||
|
HandlerType: (*MetricsServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{},
|
||||||
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "Export",
|
||||||
|
Handler: _MetricsService_Export_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Metadata: "opencensus/proto/agent/metrics/v1/metrics_service.proto",
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("opencensus/proto/agent/metrics/v1/metrics_service.proto", fileDescriptor_metrics_service_0b252d64875a1756)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_metrics_service_0b252d64875a1756 = []byte{
|
||||||
|
// 340 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x4a, 0xf3, 0x40,
|
||||||
|
0x14, 0x85, 0xff, 0xf9, 0x2b, 0x55, 0xa6, 0xe0, 0x62, 0xdc, 0x94, 0x2a, 0x52, 0xab, 0x48, 0x45,
|
||||||
|
0x32, 0x63, 0xea, 0x42, 0x10, 0x54, 0x28, 0xb8, 0x11, 0x94, 0x12, 0x77, 0x6e, 0xa4, 0x4d, 0x2f,
|
||||||
|
0x71, 0x16, 0x99, 0x1b, 0x67, 0x26, 0xc1, 0x57, 0x70, 0xe5, 0x3b, 0xf8, 0x5c, 0x3e, 0x8c, 0x24,
|
||||||
|
0x93, 0xb4, 0x94, 0x18, 0x0b, 0xee, 0x2e, 0x99, 0xf3, 0x9d, 0x9c, 0x33, 0x73, 0xe9, 0x05, 0x26,
|
||||||
|
0xa0, 0x42, 0x50, 0x26, 0x35, 0x22, 0xd1, 0x68, 0x51, 0x4c, 0x23, 0x50, 0x56, 0xc4, 0x60, 0xb5,
|
||||||
|
0x0c, 0x8d, 0xc8, 0xfc, 0x6a, 0x7c, 0x36, 0xa0, 0x33, 0x19, 0x02, 0x2f, 0x64, 0xec, 0x60, 0x09,
|
||||||
|
0xba, 0x2f, 0xbc, 0x00, 0x79, 0xa9, 0xe6, 0x99, 0xdf, 0xf3, 0x1a, 0xbc, 0x43, 0x8c, 0x63, 0x54,
|
||||||
|
0xb9, 0xb5, 0x9b, 0x1c, 0xdf, 0x3b, 0xa9, 0xc9, 0xeb, 0x21, 0x4a, 0xe9, 0x69, 0x4d, 0xaa, 0xc1,
|
||||||
|
0x60, 0xaa, 0x43, 0xc8, 0xb5, 0xd5, 0xec, 0xc4, 0x83, 0x2f, 0x42, 0x77, 0x6f, 0xdf, 0x12, 0xd4,
|
||||||
|
0xf6, 0xde, 0x99, 0x3c, 0xba, 0x22, 0x01, 0xbc, 0xa6, 0x60, 0x2c, 0xbb, 0xa4, 0x1b, 0x0a, 0xe7,
|
||||||
|
0xd0, 0x25, 0x7d, 0x32, 0xec, 0x8c, 0x8e, 0x79, 0x43, 0xb1, 0x32, 0x6b, 0xe6, 0xf3, 0x07, 0x9c,
|
||||||
|
0x43, 0x50, 0x30, 0xec, 0x8a, 0x6e, 0x96, 0xc9, 0xba, 0xff, 0xfb, 0xad, 0x61, 0x67, 0x74, 0x58,
|
||||||
|
0xc7, 0x97, 0x37, 0xc2, 0x5d, 0x80, 0xa0, 0x62, 0xd8, 0x98, 0x6e, 0x55, 0x61, 0xbb, 0xad, 0xa6,
|
||||||
|
0xdf, 0x2f, 0xea, 0x64, 0x3e, 0x0f, 0xca, 0x39, 0x58, 0x70, 0x83, 0x7d, 0xba, 0xf7, 0x73, 0x3b,
|
||||||
|
0x93, 0xa0, 0x32, 0x30, 0xfa, 0x24, 0x74, 0x7b, 0xf5, 0x88, 0x7d, 0x10, 0xda, 0x76, 0x0c, 0xbb,
|
||||||
|
0xe6, 0x6b, 0xdf, 0x91, 0xff, 0x72, 0x79, 0xbd, 0x9b, 0x3f, 0xf3, 0x2e, 0xde, 0xe0, 0xdf, 0x90,
|
||||||
|
0x9c, 0x91, 0xf1, 0x3b, 0xa1, 0x47, 0x12, 0xd7, 0x7b, 0x8d, 0x77, 0x56, 0x6d, 0x26, 0xb9, 0x6a,
|
||||||
|
0x42, 0x9e, 0xee, 0x22, 0x69, 0x5f, 0xd2, 0x59, 0xfe, 0x48, 0xc2, 0x19, 0x78, 0x52, 0x19, 0xab,
|
||||||
|
0xd3, 0x18, 0x94, 0x9d, 0x5a, 0x89, 0x4a, 0x2c, 0xbd, 0x3d, 0xb7, 0x32, 0x11, 0x28, 0x2f, 0xaa,
|
||||||
|
0xef, 0xfb, 0xac, 0x5d, 0x1c, 0x9f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x16, 0x61, 0x3b, 0xc3,
|
||||||
|
0x1b, 0x03, 0x00, 0x00,
|
||||||
|
}
|
440
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go
generated
vendored
Normal file
440
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,440 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: opencensus/proto/agent/trace/v1/trace_service.proto
|
||||||
|
|
||||||
|
package v1 // import "github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
import v1 "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
|
||||||
|
import v12 "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1"
|
||||||
|
import v11 "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "golang.org/x/net/context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
type CurrentLibraryConfig struct {
|
||||||
|
// This is required only in the first message on the stream or if the
|
||||||
|
// previous sent CurrentLibraryConfig message has a different Node (e.g.
|
||||||
|
// when the same RPC is used to configure multiple Applications).
|
||||||
|
Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
|
||||||
|
// Current configuration.
|
||||||
|
Config *v11.TraceConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CurrentLibraryConfig) Reset() { *m = CurrentLibraryConfig{} }
|
||||||
|
func (m *CurrentLibraryConfig) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CurrentLibraryConfig) ProtoMessage() {}
|
||||||
|
func (*CurrentLibraryConfig) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_service_14d467877eaed17f, []int{0}
|
||||||
|
}
|
||||||
|
func (m *CurrentLibraryConfig) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CurrentLibraryConfig.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CurrentLibraryConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CurrentLibraryConfig.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CurrentLibraryConfig) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CurrentLibraryConfig.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CurrentLibraryConfig) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CurrentLibraryConfig.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CurrentLibraryConfig) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CurrentLibraryConfig.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CurrentLibraryConfig proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CurrentLibraryConfig) GetNode() *v1.Node {
|
||||||
|
if m != nil {
|
||||||
|
return m.Node
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CurrentLibraryConfig) GetConfig() *v11.TraceConfig {
|
||||||
|
if m != nil {
|
||||||
|
return m.Config
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdatedLibraryConfig struct {
|
||||||
|
// This field is ignored when the RPC is used to configure only one Application.
|
||||||
|
// This is required only in the first message on the stream or if the
|
||||||
|
// previous sent UpdatedLibraryConfig message has a different Node.
|
||||||
|
Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
|
||||||
|
// Requested updated configuration.
|
||||||
|
Config *v11.TraceConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UpdatedLibraryConfig) Reset() { *m = UpdatedLibraryConfig{} }
|
||||||
|
func (m *UpdatedLibraryConfig) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*UpdatedLibraryConfig) ProtoMessage() {}
|
||||||
|
func (*UpdatedLibraryConfig) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_service_14d467877eaed17f, []int{1}
|
||||||
|
}
|
||||||
|
func (m *UpdatedLibraryConfig) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_UpdatedLibraryConfig.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *UpdatedLibraryConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_UpdatedLibraryConfig.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *UpdatedLibraryConfig) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_UpdatedLibraryConfig.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *UpdatedLibraryConfig) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_UpdatedLibraryConfig.Size(m)
|
||||||
|
}
|
||||||
|
func (m *UpdatedLibraryConfig) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_UpdatedLibraryConfig.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_UpdatedLibraryConfig proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *UpdatedLibraryConfig) GetNode() *v1.Node {
|
||||||
|
if m != nil {
|
||||||
|
return m.Node
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UpdatedLibraryConfig) GetConfig() *v11.TraceConfig {
|
||||||
|
if m != nil {
|
||||||
|
return m.Config
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExportTraceServiceRequest struct {
|
||||||
|
// This is required only in the first message on the stream or if the
|
||||||
|
// previous sent ExportTraceServiceRequest message has a different Node (e.g.
|
||||||
|
// when the same RPC is used to send Spans from multiple Applications).
|
||||||
|
Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
|
||||||
|
// A list of Spans that belong to the last received Node.
|
||||||
|
Spans []*v11.Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"`
|
||||||
|
// The resource for the spans in this message that do not have an explicit
|
||||||
|
// resource set.
|
||||||
|
// If unset, the most recently set resource in the RPC stream applies. It is
|
||||||
|
// valid to never be set within a stream, e.g. when no resource info is known.
|
||||||
|
Resource *v12.Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportTraceServiceRequest) Reset() { *m = ExportTraceServiceRequest{} }
|
||||||
|
func (m *ExportTraceServiceRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ExportTraceServiceRequest) ProtoMessage() {}
|
||||||
|
func (*ExportTraceServiceRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_service_14d467877eaed17f, []int{2}
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ExportTraceServiceRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ExportTraceServiceRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ExportTraceServiceRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ExportTraceServiceRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ExportTraceServiceRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ExportTraceServiceRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ExportTraceServiceRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ExportTraceServiceRequest) GetNode() *v1.Node {
|
||||||
|
if m != nil {
|
||||||
|
return m.Node
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportTraceServiceRequest) GetSpans() []*v11.Span {
|
||||||
|
if m != nil {
|
||||||
|
return m.Spans
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportTraceServiceRequest) GetResource() *v12.Resource {
|
||||||
|
if m != nil {
|
||||||
|
return m.Resource
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExportTraceServiceResponse struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ExportTraceServiceResponse) Reset() { *m = ExportTraceServiceResponse{} }
|
||||||
|
func (m *ExportTraceServiceResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ExportTraceServiceResponse) ProtoMessage() {}
|
||||||
|
func (*ExportTraceServiceResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_service_14d467877eaed17f, []int{3}
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ExportTraceServiceResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ExportTraceServiceResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ExportTraceServiceResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ExportTraceServiceResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ExportTraceServiceResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ExportTraceServiceResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ExportTraceServiceResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ExportTraceServiceResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*CurrentLibraryConfig)(nil), "opencensus.proto.agent.trace.v1.CurrentLibraryConfig")
|
||||||
|
proto.RegisterType((*UpdatedLibraryConfig)(nil), "opencensus.proto.agent.trace.v1.UpdatedLibraryConfig")
|
||||||
|
proto.RegisterType((*ExportTraceServiceRequest)(nil), "opencensus.proto.agent.trace.v1.ExportTraceServiceRequest")
|
||||||
|
proto.RegisterType((*ExportTraceServiceResponse)(nil), "opencensus.proto.agent.trace.v1.ExportTraceServiceResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ context.Context
|
||||||
|
var _ grpc.ClientConn
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
|
// TraceServiceClient is the client API for TraceService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||||
|
type TraceServiceClient interface {
|
||||||
|
// After initialization, this RPC must be kept alive for the entire life of
|
||||||
|
// the application. The agent pushes configs down to applications via a
|
||||||
|
// stream.
|
||||||
|
Config(ctx context.Context, opts ...grpc.CallOption) (TraceService_ConfigClient, error)
|
||||||
|
// For performance reasons, it is recommended to keep this RPC
|
||||||
|
// alive for the entire life of the application.
|
||||||
|
Export(ctx context.Context, opts ...grpc.CallOption) (TraceService_ExportClient, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type traceServiceClient struct {
|
||||||
|
cc *grpc.ClientConn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTraceServiceClient(cc *grpc.ClientConn) TraceServiceClient {
|
||||||
|
return &traceServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *traceServiceClient) Config(ctx context.Context, opts ...grpc.CallOption) (TraceService_ConfigClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &_TraceService_serviceDesc.Streams[0], "/opencensus.proto.agent.trace.v1.TraceService/Config", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &traceServiceConfigClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceService_ConfigClient interface {
|
||||||
|
Send(*CurrentLibraryConfig) error
|
||||||
|
Recv() (*UpdatedLibraryConfig, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type traceServiceConfigClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceConfigClient) Send(m *CurrentLibraryConfig) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceConfigClient) Recv() (*UpdatedLibraryConfig, error) {
|
||||||
|
m := new(UpdatedLibraryConfig)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *traceServiceClient) Export(ctx context.Context, opts ...grpc.CallOption) (TraceService_ExportClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &_TraceService_serviceDesc.Streams[1], "/opencensus.proto.agent.trace.v1.TraceService/Export", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &traceServiceExportClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceService_ExportClient interface {
|
||||||
|
Send(*ExportTraceServiceRequest) error
|
||||||
|
Recv() (*ExportTraceServiceResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type traceServiceExportClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceExportClient) Send(m *ExportTraceServiceRequest) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceExportClient) Recv() (*ExportTraceServiceResponse, error) {
|
||||||
|
m := new(ExportTraceServiceResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TraceServiceServer is the server API for TraceService service.
|
||||||
|
type TraceServiceServer interface {
|
||||||
|
// After initialization, this RPC must be kept alive for the entire life of
|
||||||
|
// the application. The agent pushes configs down to applications via a
|
||||||
|
// stream.
|
||||||
|
Config(TraceService_ConfigServer) error
|
||||||
|
// For performance reasons, it is recommended to keep this RPC
|
||||||
|
// alive for the entire life of the application.
|
||||||
|
Export(TraceService_ExportServer) error
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterTraceServiceServer(s *grpc.Server, srv TraceServiceServer) {
|
||||||
|
s.RegisterService(&_TraceService_serviceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TraceService_Config_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(TraceServiceServer).Config(&traceServiceConfigServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceService_ConfigServer interface {
|
||||||
|
Send(*UpdatedLibraryConfig) error
|
||||||
|
Recv() (*CurrentLibraryConfig, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type traceServiceConfigServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceConfigServer) Send(m *UpdatedLibraryConfig) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceConfigServer) Recv() (*CurrentLibraryConfig, error) {
|
||||||
|
m := new(CurrentLibraryConfig)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TraceService_Export_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(TraceServiceServer).Export(&traceServiceExportServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceService_ExportServer interface {
|
||||||
|
Send(*ExportTraceServiceResponse) error
|
||||||
|
Recv() (*ExportTraceServiceRequest, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type traceServiceExportServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceExportServer) Send(m *ExportTraceServiceResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *traceServiceExportServer) Recv() (*ExportTraceServiceRequest, error) {
|
||||||
|
m := new(ExportTraceServiceRequest)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _TraceService_serviceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "opencensus.proto.agent.trace.v1.TraceService",
|
||||||
|
HandlerType: (*TraceServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{},
|
||||||
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "Config",
|
||||||
|
Handler: _TraceService_Config_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StreamName: "Export",
|
||||||
|
Handler: _TraceService_Export_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Metadata: "opencensus/proto/agent/trace/v1/trace_service.proto",
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("opencensus/proto/agent/trace/v1/trace_service.proto", fileDescriptor_trace_service_14d467877eaed17f)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_trace_service_14d467877eaed17f = []byte{
|
||||||
|
// 423 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xbf, 0x6b, 0xdb, 0x40,
|
||||||
|
0x14, 0xee, 0xd9, 0xad, 0x28, 0xe7, 0x2e, 0x15, 0x1d, 0x54, 0x51, 0xb0, 0x11, 0xb4, 0x18, 0x5a,
|
||||||
|
0x9d, 0x2a, 0x1b, 0x2f, 0x2e, 0x74, 0xb0, 0x29, 0x74, 0x28, 0xc5, 0xc8, 0xed, 0x92, 0xc5, 0xc8,
|
||||||
|
0xd2, 0x8b, 0xa2, 0xc1, 0x77, 0xca, 0xdd, 0x49, 0x24, 0x90, 0x2d, 0x43, 0xf6, 0x0c, 0xf9, 0xc3,
|
||||||
|
0xf2, 0x17, 0x05, 0xdd, 0xc9, 0x3f, 0x12, 0x5b, 0x11, 0x24, 0x4b, 0xb6, 0x87, 0xde, 0xf7, 0x7d,
|
||||||
|
0xf7, 0xbd, 0x7b, 0xdf, 0x09, 0x0f, 0x59, 0x06, 0x34, 0x02, 0x2a, 0x72, 0xe1, 0x65, 0x9c, 0x49,
|
||||||
|
0xe6, 0x85, 0x09, 0x50, 0xe9, 0x49, 0x1e, 0x46, 0xe0, 0x15, 0xbe, 0x2e, 0x16, 0x02, 0x78, 0x91,
|
||||||
|
0x46, 0x40, 0x14, 0xc4, 0xec, 0x6e, 0x49, 0xfa, 0x0b, 0x51, 0x24, 0xa2, 0xb0, 0xa4, 0xf0, 0x6d,
|
||||||
|
0xb7, 0x46, 0x35, 0x62, 0xab, 0x15, 0xa3, 0xa5, 0xac, 0xae, 0x34, 0xdb, 0xfe, 0xba, 0x07, 0xe7,
|
||||||
|
0x20, 0x58, 0xce, 0xb5, 0x83, 0x75, 0x5d, 0x81, 0x3f, 0xef, 0x81, 0xef, 0x7b, 0xad, 0x60, 0xdf,
|
||||||
|
0x1a, 0x60, 0x8b, 0x88, 0xd1, 0xe3, 0x34, 0xd1, 0x68, 0xe7, 0x1a, 0xe1, 0x0f, 0xd3, 0x9c, 0x73,
|
||||||
|
0xa0, 0xf2, 0x4f, 0xba, 0xe4, 0x21, 0x3f, 0x9f, 0xaa, 0xb6, 0x39, 0xc6, 0xaf, 0x29, 0x8b, 0xc1,
|
||||||
|
0x42, 0x3d, 0xd4, 0xef, 0x0c, 0xbe, 0x90, 0x9a, 0xc9, 0xab, 0x71, 0x0a, 0x9f, 0xfc, 0x65, 0x31,
|
||||||
|
0x04, 0x8a, 0x63, 0xfe, 0xc4, 0x86, 0x3e, 0xc4, 0x6a, 0xd5, 0xb1, 0xd7, 0x37, 0x46, 0xfe, 0x95,
|
||||||
|
0x85, 0x3e, 0x33, 0xa8, 0x58, 0xca, 0xd4, 0xff, 0x2c, 0x0e, 0x25, 0xc4, 0x2f, 0xc7, 0xd4, 0x2d,
|
||||||
|
0xc2, 0x1f, 0x7f, 0x9d, 0x65, 0x8c, 0x4b, 0xd5, 0x9d, 0xeb, 0x60, 0x04, 0x70, 0x9a, 0x83, 0x90,
|
||||||
|
0xcf, 0x72, 0x36, 0xc2, 0x6f, 0x44, 0x16, 0x52, 0x61, 0xb5, 0x7a, 0xed, 0x7e, 0x67, 0xd0, 0x7d,
|
||||||
|
0xc4, 0xd8, 0x3c, 0x0b, 0x69, 0xa0, 0xd1, 0xe6, 0x04, 0xbf, 0x5d, 0x27, 0xc4, 0x6a, 0xd7, 0x1d,
|
||||||
|
0xbb, 0xc9, 0x50, 0xe1, 0x93, 0xa0, 0xaa, 0x83, 0x0d, 0xcf, 0xf9, 0x84, 0xed, 0x43, 0x33, 0x89,
|
||||||
|
0x8c, 0x51, 0x01, 0x83, 0x9b, 0x16, 0x7e, 0xb7, 0xdb, 0x30, 0x2f, 0xb0, 0x51, 0x6d, 0x62, 0x44,
|
||||||
|
0x1a, 0x9e, 0x02, 0x39, 0x94, 0x2a, 0xbb, 0x99, 0x76, 0x68, 0xef, 0xce, 0xab, 0x3e, 0xfa, 0x8e,
|
||||||
|
0xcc, 0x2b, 0x84, 0x0d, 0xed, 0xd6, 0x1c, 0x37, 0xea, 0xd4, 0xae, 0xca, 0xfe, 0xf1, 0x24, 0xae,
|
||||||
|
0xbe, 0x12, 0xed, 0x64, 0x72, 0x89, 0xb0, 0x93, 0xb2, 0x26, 0x9d, 0xc9, 0xfb, 0x5d, 0x89, 0x59,
|
||||||
|
0x89, 0x98, 0xa1, 0xa3, 0xdf, 0x49, 0x2a, 0x4f, 0xf2, 0x65, 0x19, 0x05, 0x4f, 0x93, 0xdd, 0x94,
|
||||||
|
0x0a, 0xc9, 0xf3, 0x15, 0x50, 0x19, 0xca, 0x94, 0x51, 0x6f, 0xab, 0xeb, 0xea, 0x17, 0x9c, 0x00,
|
||||||
|
0x75, 0x93, 0x87, 0x7f, 0xa8, 0xa5, 0xa1, 0x9a, 0xc3, 0xbb, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf,
|
||||||
|
0x9c, 0x9b, 0xf7, 0xcb, 0x04, 0x00, 0x00,
|
||||||
|
}
|
159
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go
generated
vendored
Normal file
159
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go
generated
vendored
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||||
|
// source: opencensus/proto/agent/trace/v1/trace_service.proto
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package v1 is a reverse proxy.
|
||||||
|
|
||||||
|
It translates gRPC into RESTful JSON APIs.
|
||||||
|
*/
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ codes.Code
|
||||||
|
var _ io.Reader
|
||||||
|
var _ status.Status
|
||||||
|
var _ = runtime.String
|
||||||
|
var _ = utilities.NewDoubleArray
|
||||||
|
|
||||||
|
func request_TraceService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client TraceServiceClient, req *http.Request, pathParams map[string]string) (TraceService_ExportClient, runtime.ServerMetadata, error) {
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
stream, err := client.Export(ctx)
|
||||||
|
if err != nil {
|
||||||
|
grpclog.Infof("Failed to start streaming: %v", err)
|
||||||
|
return nil, metadata, err
|
||||||
|
}
|
||||||
|
dec := marshaler.NewDecoder(req.Body)
|
||||||
|
handleSend := func() error {
|
||||||
|
var protoReq ExportTraceServiceRequest
|
||||||
|
err := dec.Decode(&protoReq)
|
||||||
|
if err == io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
grpclog.Infof("Failed to decode request: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := stream.Send(&protoReq); err != nil {
|
||||||
|
grpclog.Infof("Failed to send request: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err := handleSend(); err != nil {
|
||||||
|
if cerr := stream.CloseSend(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to terminate client stream: %v", cerr)
|
||||||
|
}
|
||||||
|
if err == io.EOF {
|
||||||
|
return stream, metadata, nil
|
||||||
|
}
|
||||||
|
return nil, metadata, err
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
if err := handleSend(); err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := stream.CloseSend(); err != nil {
|
||||||
|
grpclog.Infof("Failed to terminate client stream: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
header, err := stream.Header()
|
||||||
|
if err != nil {
|
||||||
|
grpclog.Infof("Failed to get header from client: %v", err)
|
||||||
|
return nil, metadata, err
|
||||||
|
}
|
||||||
|
metadata.HeaderMD = header
|
||||||
|
return stream, metadata, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterTraceServiceHandlerFromEndpoint is same as RegisterTraceServiceHandler but
|
||||||
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||||
|
func RegisterTraceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||||
|
conn, err := grpc.Dial(endpoint, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}()
|
||||||
|
|
||||||
|
return RegisterTraceServiceHandler(ctx, mux, conn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterTraceServiceHandler registers the http handlers for service TraceService to "mux".
|
||||||
|
// The handlers forward requests to the grpc endpoint over "conn".
|
||||||
|
func RegisterTraceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||||
|
return RegisterTraceServiceHandlerClient(ctx, mux, NewTraceServiceClient(conn))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterTraceServiceHandlerClient registers the http handlers for service TraceService
|
||||||
|
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TraceServiceClient".
|
||||||
|
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TraceServiceClient"
|
||||||
|
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||||
|
// "TraceServiceClient" to call the correct interceptors.
|
||||||
|
func RegisterTraceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TraceServiceClient) error {
|
||||||
|
|
||||||
|
mux.Handle("POST", pattern_TraceService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
if cn, ok := w.(http.CloseNotifier); ok {
|
||||||
|
go func(done <-chan struct{}, closed <-chan bool) {
|
||||||
|
select {
|
||||||
|
case <-done:
|
||||||
|
case <-closed:
|
||||||
|
cancel()
|
||||||
|
}
|
||||||
|
}(ctx.Done(), cn.CloseNotify())
|
||||||
|
}
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_TraceService_Export_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_TraceService_Export_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
pattern_TraceService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "trace"}, ""))
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
forward_TraceService_Export_0 = runtime.ForwardResponseStream
|
||||||
|
)
|
1352
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go
generated
vendored
Normal file
1352
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
96
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go
generated
vendored
Normal file
96
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: opencensus/proto/resource/v1/resource.proto
|
||||||
|
|
||||||
|
package v1 // import "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// Resource information.
|
||||||
|
type Resource struct {
|
||||||
|
// Type identifier for the resource.
|
||||||
|
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
|
// Set of labels that describe the resource.
|
||||||
|
Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Resource) Reset() { *m = Resource{} }
|
||||||
|
func (m *Resource) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Resource) ProtoMessage() {}
|
||||||
|
func (*Resource) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_resource_471b1e1cf1b04db0, []int{0}
|
||||||
|
}
|
||||||
|
func (m *Resource) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Resource.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Resource.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Resource) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Resource.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Resource) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Resource.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Resource) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Resource.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Resource proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Resource) GetType() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Type
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Resource) GetLabels() map[string]string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Labels
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*Resource)(nil), "opencensus.proto.resource.v1.Resource")
|
||||||
|
proto.RegisterMapType((map[string]string)(nil), "opencensus.proto.resource.v1.Resource.LabelsEntry")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("opencensus/proto/resource/v1/resource.proto", fileDescriptor_resource_471b1e1cf1b04db0)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_resource_471b1e1cf1b04db0 = []byte{
|
||||||
|
// 234 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xce, 0x2f, 0x48, 0xcd,
|
||||||
|
0x4b, 0x4e, 0xcd, 0x2b, 0x2e, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x4a, 0x2d,
|
||||||
|
0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0xc0, 0x52, 0x42, 0x32, 0x08,
|
||||||
|
0xc5, 0x10, 0x11, 0x3d, 0xb8, 0x82, 0x32, 0x43, 0xa5, 0xa5, 0x8c, 0x5c, 0x1c, 0x41, 0x50, 0xbe,
|
||||||
|
0x90, 0x10, 0x17, 0x4b, 0x49, 0x65, 0x41, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98,
|
||||||
|
0x2d, 0xe4, 0xc5, 0xc5, 0x96, 0x93, 0x98, 0x94, 0x9a, 0x53, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1,
|
||||||
|
0x6d, 0x64, 0xa4, 0x87, 0xcf, 0x3c, 0x3d, 0x98, 0x59, 0x7a, 0x3e, 0x60, 0x4d, 0xae, 0x79, 0x25,
|
||||||
|
0x45, 0x95, 0x41, 0x50, 0x13, 0xa4, 0x2c, 0xb9, 0xb8, 0x91, 0x84, 0x85, 0x04, 0xb8, 0x98, 0xb3,
|
||||||
|
0x53, 0x2b, 0xa1, 0xb6, 0x81, 0x98, 0x42, 0x22, 0x5c, 0xac, 0x65, 0x89, 0x39, 0xa5, 0xa9, 0x12,
|
||||||
|
0x4c, 0x60, 0x31, 0x08, 0xc7, 0x8a, 0xc9, 0x82, 0xd1, 0xa9, 0x92, 0x4b, 0x3e, 0x33, 0x1f, 0xaf,
|
||||||
|
0xd5, 0x4e, 0xbc, 0x30, 0xbb, 0x03, 0x40, 0x52, 0x01, 0x8c, 0x51, 0xae, 0xe9, 0x99, 0x25, 0x19,
|
||||||
|
0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x10, 0x5d, 0xba, 0x99, 0x79, 0xc5, 0x25, 0x45, 0xa5,
|
||||||
|
0xb9, 0xa9, 0x79, 0x25, 0x89, 0x25, 0x99, 0xf9, 0x79, 0xfa, 0x08, 0x03, 0x75, 0x21, 0x01, 0x99,
|
||||||
|
0x9e, 0x9a, 0xa7, 0x9b, 0x8e, 0x12, 0x9e, 0x49, 0x6c, 0x60, 0x19, 0x63, 0x40, 0x00, 0x00, 0x00,
|
||||||
|
0xff, 0xff, 0x8e, 0x11, 0xaf, 0xda, 0x76, 0x01, 0x00, 0x00,
|
||||||
|
}
|
1629
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go
generated
vendored
Normal file
1629
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
400
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go
generated
vendored
Normal file
400
vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,400 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: opencensus/proto/trace/v1/trace_config.proto
|
||||||
|
|
||||||
|
package v1 // import "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// Global configuration of the trace service.
|
||||||
|
type TraceConfig struct {
|
||||||
|
// The global default sampler used to make decisions on span sampling.
|
||||||
|
//
|
||||||
|
// Types that are valid to be assigned to Sampler:
|
||||||
|
// *TraceConfig_ProbabilitySampler
|
||||||
|
// *TraceConfig_ConstantSampler
|
||||||
|
// *TraceConfig_RateLimitingSampler
|
||||||
|
Sampler isTraceConfig_Sampler `protobuf_oneof:"sampler"`
|
||||||
|
// The global default max number of attributes per span.
|
||||||
|
MaxNumberOfAttributes int64 `protobuf:"varint,4,opt,name=max_number_of_attributes,json=maxNumberOfAttributes,proto3" json:"max_number_of_attributes,omitempty"`
|
||||||
|
// The global default max number of annotation events per span.
|
||||||
|
MaxNumberOfAnnotations int64 `protobuf:"varint,5,opt,name=max_number_of_annotations,json=maxNumberOfAnnotations,proto3" json:"max_number_of_annotations,omitempty"`
|
||||||
|
// The global default max number of message events per span.
|
||||||
|
MaxNumberOfMessageEvents int64 `protobuf:"varint,6,opt,name=max_number_of_message_events,json=maxNumberOfMessageEvents,proto3" json:"max_number_of_message_events,omitempty"`
|
||||||
|
// The global default max number of link entries per span.
|
||||||
|
MaxNumberOfLinks int64 `protobuf:"varint,7,opt,name=max_number_of_links,json=maxNumberOfLinks,proto3" json:"max_number_of_links,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) Reset() { *m = TraceConfig{} }
|
||||||
|
func (m *TraceConfig) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*TraceConfig) ProtoMessage() {}
|
||||||
|
func (*TraceConfig) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_config_2f6d4a0dc67515b2, []int{0}
|
||||||
|
}
|
||||||
|
func (m *TraceConfig) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_TraceConfig.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_TraceConfig.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *TraceConfig) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_TraceConfig.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *TraceConfig) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_TraceConfig.Size(m)
|
||||||
|
}
|
||||||
|
func (m *TraceConfig) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_TraceConfig.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_TraceConfig proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type isTraceConfig_Sampler interface {
|
||||||
|
isTraceConfig_Sampler()
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceConfig_ProbabilitySampler struct {
|
||||||
|
ProbabilitySampler *ProbabilitySampler `protobuf:"bytes,1,opt,name=probability_sampler,json=probabilitySampler,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceConfig_ConstantSampler struct {
|
||||||
|
ConstantSampler *ConstantSampler `protobuf:"bytes,2,opt,name=constant_sampler,json=constantSampler,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceConfig_RateLimitingSampler struct {
|
||||||
|
RateLimitingSampler *RateLimitingSampler `protobuf:"bytes,3,opt,name=rate_limiting_sampler,json=rateLimitingSampler,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TraceConfig_ProbabilitySampler) isTraceConfig_Sampler() {}
|
||||||
|
|
||||||
|
func (*TraceConfig_ConstantSampler) isTraceConfig_Sampler() {}
|
||||||
|
|
||||||
|
func (*TraceConfig_RateLimitingSampler) isTraceConfig_Sampler() {}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetSampler() isTraceConfig_Sampler {
|
||||||
|
if m != nil {
|
||||||
|
return m.Sampler
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetProbabilitySampler() *ProbabilitySampler {
|
||||||
|
if x, ok := m.GetSampler().(*TraceConfig_ProbabilitySampler); ok {
|
||||||
|
return x.ProbabilitySampler
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetConstantSampler() *ConstantSampler {
|
||||||
|
if x, ok := m.GetSampler().(*TraceConfig_ConstantSampler); ok {
|
||||||
|
return x.ConstantSampler
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetRateLimitingSampler() *RateLimitingSampler {
|
||||||
|
if x, ok := m.GetSampler().(*TraceConfig_RateLimitingSampler); ok {
|
||||||
|
return x.RateLimitingSampler
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetMaxNumberOfAttributes() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.MaxNumberOfAttributes
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetMaxNumberOfAnnotations() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.MaxNumberOfAnnotations
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetMaxNumberOfMessageEvents() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.MaxNumberOfMessageEvents
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TraceConfig) GetMaxNumberOfLinks() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.MaxNumberOfLinks
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||||
|
func (*TraceConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||||
|
return _TraceConfig_OneofMarshaler, _TraceConfig_OneofUnmarshaler, _TraceConfig_OneofSizer, []interface{}{
|
||||||
|
(*TraceConfig_ProbabilitySampler)(nil),
|
||||||
|
(*TraceConfig_ConstantSampler)(nil),
|
||||||
|
(*TraceConfig_RateLimitingSampler)(nil),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TraceConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||||
|
m := msg.(*TraceConfig)
|
||||||
|
// sampler
|
||||||
|
switch x := m.Sampler.(type) {
|
||||||
|
case *TraceConfig_ProbabilitySampler:
|
||||||
|
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||||
|
if err := b.EncodeMessage(x.ProbabilitySampler); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case *TraceConfig_ConstantSampler:
|
||||||
|
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||||
|
if err := b.EncodeMessage(x.ConstantSampler); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case *TraceConfig_RateLimitingSampler:
|
||||||
|
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||||
|
if err := b.EncodeMessage(x.RateLimitingSampler); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case nil:
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("TraceConfig.Sampler has unexpected type %T", x)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TraceConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||||
|
m := msg.(*TraceConfig)
|
||||||
|
switch tag {
|
||||||
|
case 1: // sampler.probability_sampler
|
||||||
|
if wire != proto.WireBytes {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
msg := new(ProbabilitySampler)
|
||||||
|
err := b.DecodeMessage(msg)
|
||||||
|
m.Sampler = &TraceConfig_ProbabilitySampler{msg}
|
||||||
|
return true, err
|
||||||
|
case 2: // sampler.constant_sampler
|
||||||
|
if wire != proto.WireBytes {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
msg := new(ConstantSampler)
|
||||||
|
err := b.DecodeMessage(msg)
|
||||||
|
m.Sampler = &TraceConfig_ConstantSampler{msg}
|
||||||
|
return true, err
|
||||||
|
case 3: // sampler.rate_limiting_sampler
|
||||||
|
if wire != proto.WireBytes {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
msg := new(RateLimitingSampler)
|
||||||
|
err := b.DecodeMessage(msg)
|
||||||
|
m.Sampler = &TraceConfig_RateLimitingSampler{msg}
|
||||||
|
return true, err
|
||||||
|
default:
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TraceConfig_OneofSizer(msg proto.Message) (n int) {
|
||||||
|
m := msg.(*TraceConfig)
|
||||||
|
// sampler
|
||||||
|
switch x := m.Sampler.(type) {
|
||||||
|
case *TraceConfig_ProbabilitySampler:
|
||||||
|
s := proto.Size(x.ProbabilitySampler)
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += proto.SizeVarint(uint64(s))
|
||||||
|
n += s
|
||||||
|
case *TraceConfig_ConstantSampler:
|
||||||
|
s := proto.Size(x.ConstantSampler)
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += proto.SizeVarint(uint64(s))
|
||||||
|
n += s
|
||||||
|
case *TraceConfig_RateLimitingSampler:
|
||||||
|
s := proto.Size(x.RateLimitingSampler)
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += proto.SizeVarint(uint64(s))
|
||||||
|
n += s
|
||||||
|
case nil:
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sampler that tries to uniformly sample traces with a given probability.
|
||||||
|
// The probability of sampling a trace is equal to that of the specified probability.
|
||||||
|
type ProbabilitySampler struct {
|
||||||
|
// The desired probability of sampling. Must be within [0.0, 1.0].
|
||||||
|
SamplingProbability float64 `protobuf:"fixed64,1,opt,name=samplingProbability,proto3" json:"samplingProbability,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ProbabilitySampler) Reset() { *m = ProbabilitySampler{} }
|
||||||
|
func (m *ProbabilitySampler) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ProbabilitySampler) ProtoMessage() {}
|
||||||
|
func (*ProbabilitySampler) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_config_2f6d4a0dc67515b2, []int{1}
|
||||||
|
}
|
||||||
|
func (m *ProbabilitySampler) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ProbabilitySampler.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ProbabilitySampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ProbabilitySampler.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ProbabilitySampler) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ProbabilitySampler.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ProbabilitySampler) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ProbabilitySampler.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ProbabilitySampler) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ProbabilitySampler.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ProbabilitySampler proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ProbabilitySampler) GetSamplingProbability() float64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.SamplingProbability
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sampler that makes a constant decision (either always "yes" or always "no")
|
||||||
|
// on span sampling.
|
||||||
|
type ConstantSampler struct {
|
||||||
|
// Whether spans should be always sampled, or never sampled.
|
||||||
|
Decision bool `protobuf:"varint,1,opt,name=decision,proto3" json:"decision,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ConstantSampler) Reset() { *m = ConstantSampler{} }
|
||||||
|
func (m *ConstantSampler) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ConstantSampler) ProtoMessage() {}
|
||||||
|
func (*ConstantSampler) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_config_2f6d4a0dc67515b2, []int{2}
|
||||||
|
}
|
||||||
|
func (m *ConstantSampler) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ConstantSampler.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ConstantSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ConstantSampler.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ConstantSampler) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ConstantSampler.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ConstantSampler) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ConstantSampler.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ConstantSampler) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ConstantSampler.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ConstantSampler proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ConstantSampler) GetDecision() bool {
|
||||||
|
if m != nil {
|
||||||
|
return m.Decision
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sampler that tries to sample with a rate per time window.
|
||||||
|
type RateLimitingSampler struct {
|
||||||
|
// Rate per second.
|
||||||
|
Qps int64 `protobuf:"varint,1,opt,name=qps,proto3" json:"qps,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RateLimitingSampler) Reset() { *m = RateLimitingSampler{} }
|
||||||
|
func (m *RateLimitingSampler) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*RateLimitingSampler) ProtoMessage() {}
|
||||||
|
func (*RateLimitingSampler) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_trace_config_2f6d4a0dc67515b2, []int{3}
|
||||||
|
}
|
||||||
|
func (m *RateLimitingSampler) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_RateLimitingSampler.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *RateLimitingSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_RateLimitingSampler.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *RateLimitingSampler) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_RateLimitingSampler.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *RateLimitingSampler) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_RateLimitingSampler.Size(m)
|
||||||
|
}
|
||||||
|
func (m *RateLimitingSampler) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_RateLimitingSampler.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_RateLimitingSampler proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *RateLimitingSampler) GetQps() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Qps
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*TraceConfig)(nil), "opencensus.proto.trace.v1.TraceConfig")
|
||||||
|
proto.RegisterType((*ProbabilitySampler)(nil), "opencensus.proto.trace.v1.ProbabilitySampler")
|
||||||
|
proto.RegisterType((*ConstantSampler)(nil), "opencensus.proto.trace.v1.ConstantSampler")
|
||||||
|
proto.RegisterType((*RateLimitingSampler)(nil), "opencensus.proto.trace.v1.RateLimitingSampler")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("opencensus/proto/trace/v1/trace_config.proto", fileDescriptor_trace_config_2f6d4a0dc67515b2)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_trace_config_2f6d4a0dc67515b2 = []byte{
|
||||||
|
// 431 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x41, 0x6f, 0xd4, 0x30,
|
||||||
|
0x10, 0x85, 0x09, 0x5b, 0xda, 0x32, 0x3d, 0x74, 0xe5, 0xa8, 0x28, 0x45, 0x3d, 0x54, 0x7b, 0xa1,
|
||||||
|
0x42, 0x24, 0xa1, 0x70, 0x40, 0x5c, 0x90, 0xd8, 0x0a, 0xc4, 0xa1, 0xc0, 0x2a, 0x20, 0x21, 0x71,
|
||||||
|
0x09, 0x4e, 0xea, 0x0d, 0x16, 0xf1, 0x38, 0xd8, 0x93, 0xa8, 0xfc, 0x17, 0x7e, 0x6c, 0x15, 0x67,
|
||||||
|
0x95, 0x64, 0xbb, 0xed, 0xde, 0xec, 0xf7, 0xde, 0xf7, 0x2c, 0x79, 0x6c, 0x78, 0xa1, 0x2b, 0x81,
|
||||||
|
0xb9, 0x40, 0x5b, 0xdb, 0xb8, 0x32, 0x9a, 0x74, 0x4c, 0x86, 0xe7, 0x22, 0x6e, 0xce, 0xbb, 0x45,
|
||||||
|
0x9a, 0x6b, 0x5c, 0xca, 0x22, 0x72, 0x1e, 0x3b, 0x1e, 0xd2, 0x9d, 0x12, 0xb9, 0x50, 0xd4, 0x9c,
|
||||||
|
0xcf, 0xfe, 0xef, 0xc0, 0xc1, 0xf7, 0x76, 0x73, 0xe1, 0x00, 0xf6, 0x0b, 0xfc, 0xca, 0xe8, 0x8c,
|
||||||
|
0x67, 0xb2, 0x94, 0xf4, 0x2f, 0xb5, 0x5c, 0x55, 0xa5, 0x30, 0x81, 0x77, 0xea, 0x9d, 0x1d, 0xbc,
|
||||||
|
0x0a, 0xa3, 0x7b, 0x8b, 0xa2, 0xc5, 0x40, 0x7d, 0xeb, 0xa0, 0x4f, 0x0f, 0x12, 0x56, 0x6d, 0xa8,
|
||||||
|
0xec, 0x07, 0x4c, 0x73, 0x8d, 0x96, 0x38, 0x52, 0x5f, 0xff, 0xd0, 0xd5, 0x3f, 0xdf, 0x52, 0x7f,
|
||||||
|
0xb1, 0x42, 0x86, 0xee, 0xc3, 0x7c, 0x5d, 0x62, 0x57, 0x70, 0x64, 0x38, 0x89, 0xb4, 0x94, 0x4a,
|
||||||
|
0x92, 0xc4, 0xa2, 0x6f, 0x9f, 0xb8, 0xf6, 0x68, 0x4b, 0x7b, 0xc2, 0x49, 0x5c, 0xae, 0xb0, 0xe1,
|
||||||
|
0x04, 0xdf, 0x6c, 0xca, 0xec, 0x0d, 0x04, 0x8a, 0x5f, 0xa7, 0x58, 0xab, 0x4c, 0x98, 0x54, 0x2f,
|
||||||
|
0x53, 0x4e, 0x64, 0x64, 0x56, 0x93, 0xb0, 0xc1, 0xce, 0xa9, 0x77, 0x36, 0x49, 0x8e, 0x14, 0xbf,
|
||||||
|
0xfe, 0xe2, 0xec, 0xaf, 0xcb, 0xf7, 0xbd, 0xc9, 0xde, 0xc2, 0xf1, 0x2d, 0x10, 0x51, 0x13, 0x27,
|
||||||
|
0xa9, 0xd1, 0x06, 0x8f, 0x1c, 0xf9, 0x64, 0x4c, 0x0e, 0x2e, 0x7b, 0x07, 0x27, 0xeb, 0xa8, 0x12,
|
||||||
|
0xd6, 0xf2, 0x42, 0xa4, 0xa2, 0x11, 0x48, 0x36, 0xd8, 0x75, 0x74, 0x30, 0xa2, 0x3f, 0x77, 0x81,
|
||||||
|
0x0f, 0xce, 0x67, 0x21, 0xf8, 0xeb, 0x7c, 0x29, 0xf1, 0x8f, 0x0d, 0xf6, 0x1c, 0x36, 0x1d, 0x61,
|
||||||
|
0x97, 0xad, 0x3e, 0x7f, 0x0c, 0x7b, 0xab, 0xab, 0x9b, 0x7d, 0x04, 0xb6, 0x39, 0x58, 0xf6, 0x12,
|
||||||
|
0x7c, 0x17, 0x90, 0x58, 0x8c, 0x5c, 0xf7, 0x48, 0xbc, 0xe4, 0x2e, 0x6b, 0x16, 0xc2, 0xe1, 0xad,
|
||||||
|
0x09, 0xb2, 0xa7, 0xb0, 0x7f, 0x25, 0x72, 0x69, 0xa5, 0x46, 0x47, 0xee, 0x27, 0xfd, 0x7e, 0xf6,
|
||||||
|
0x0c, 0xfc, 0x3b, 0x46, 0xc2, 0xa6, 0x30, 0xf9, 0x5b, 0x59, 0x97, 0x9e, 0x24, 0xed, 0x72, 0xde,
|
||||||
|
0xc0, 0x89, 0xd4, 0xf7, 0x0f, 0x76, 0x3e, 0x1d, 0xbd, 0xed, 0x45, 0x6b, 0x2d, 0xbc, 0x9f, 0xf3,
|
||||||
|
0x42, 0xd2, 0xef, 0x3a, 0x8b, 0x72, 0xad, 0xe2, 0x8e, 0x0a, 0x25, 0x5a, 0x32, 0xb5, 0x12, 0xd8,
|
||||||
|
0xdd, 0x78, 0x3c, 0x14, 0x86, 0xdd, 0xef, 0x2a, 0x04, 0x86, 0xc5, 0xf0, 0xc9, 0xb2, 0x5d, 0x27,
|
||||||
|
0xbf, 0xbe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x98, 0xa1, 0x9e, 0x88, 0x03, 0x00, 0x00,
|
||||||
|
}
|
1
vendor/github.com/go-ini/ini/.travis.yml
generated
vendored
1
vendor/github.com/go-ini/ini/.travis.yml
generated
vendored
|
@ -6,6 +6,7 @@ go:
|
||||||
- 1.8.x
|
- 1.8.x
|
||||||
- 1.9.x
|
- 1.9.x
|
||||||
- 1.10.x
|
- 1.10.x
|
||||||
|
- 1.11.x
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- go get golang.org/x/tools/cmd/cover
|
- go get golang.org/x/tools/cmd/cover
|
||||||
|
|
2
vendor/github.com/go-ini/ini/README.md
generated
vendored
2
vendor/github.com/go-ini/ini/README.md
generated
vendored
|
@ -20,6 +20,8 @@ Package ini provides INI file read and write functionality in Go.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
The minimum requirement of Go is **1.6**.
|
||||||
|
|
||||||
To use a tagged revision:
|
To use a tagged revision:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
12
vendor/github.com/go-ini/ini/file.go
generated
vendored
12
vendor/github.com/go-ini/ini/file.go
generated
vendored
|
@ -45,6 +45,9 @@ type File struct {
|
||||||
|
|
||||||
// newFile initializes File object with given data sources.
|
// newFile initializes File object with given data sources.
|
||||||
func newFile(dataSources []dataSource, opts LoadOptions) *File {
|
func newFile(dataSources []dataSource, opts LoadOptions) *File {
|
||||||
|
if len(opts.KeyValueDelimiters) == 0 {
|
||||||
|
opts.KeyValueDelimiters = "=:"
|
||||||
|
}
|
||||||
return &File{
|
return &File{
|
||||||
BlockMode: true,
|
BlockMode: true,
|
||||||
dataSources: dataSources,
|
dataSources: dataSources,
|
||||||
|
@ -227,7 +230,8 @@ func (f *File) Append(source interface{}, others ...interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
||||||
equalSign := "="
|
equalSign := DefaultFormatLeft + "=" + DefaultFormatRight
|
||||||
|
|
||||||
if PrettyFormat || PrettyEqual {
|
if PrettyFormat || PrettyEqual {
|
||||||
equalSign = " = "
|
equalSign = " = "
|
||||||
}
|
}
|
||||||
|
@ -285,7 +289,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
||||||
for _, kname := range sec.keyList {
|
for _, kname := range sec.keyList {
|
||||||
keyLength := len(kname)
|
keyLength := len(kname)
|
||||||
// First case will surround key by ` and second by """
|
// First case will surround key by ` and second by """
|
||||||
if strings.ContainsAny(kname, "\"=:") {
|
if strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters) {
|
||||||
keyLength += 2
|
keyLength += 2
|
||||||
} else if strings.Contains(kname, "`") {
|
} else if strings.Contains(kname, "`") {
|
||||||
keyLength += 6
|
keyLength += 6
|
||||||
|
@ -310,7 +314,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
||||||
lines := strings.Split(key.Comment, LineBreak)
|
lines := strings.Split(key.Comment, LineBreak)
|
||||||
for i := range lines {
|
for i := range lines {
|
||||||
if lines[i][0] != '#' && lines[i][0] != ';' {
|
if lines[i][0] != '#' && lines[i][0] != ';' {
|
||||||
lines[i] = "; " + lines[i]
|
lines[i] = "; " + strings.TrimSpace(lines[i])
|
||||||
} else {
|
} else {
|
||||||
lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:])
|
lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:])
|
||||||
}
|
}
|
||||||
|
@ -328,7 +332,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
||||||
switch {
|
switch {
|
||||||
case key.isAutoIncrement:
|
case key.isAutoIncrement:
|
||||||
kname = "-"
|
kname = "-"
|
||||||
case strings.ContainsAny(kname, "\"=:"):
|
case strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters):
|
||||||
kname = "`" + kname + "`"
|
kname = "`" + kname + "`"
|
||||||
case strings.Contains(kname, "`"):
|
case strings.Contains(kname, "`"):
|
||||||
kname = `"""` + kname + `"""`
|
kname = `"""` + kname + `"""`
|
||||||
|
|
8
vendor/github.com/go-ini/ini/ini.go
generated
vendored
8
vendor/github.com/go-ini/ini/ini.go
generated
vendored
|
@ -34,7 +34,7 @@ const (
|
||||||
|
|
||||||
// Maximum allowed depth when recursively substituing variable names.
|
// Maximum allowed depth when recursively substituing variable names.
|
||||||
_DEPTH_VALUES = 99
|
_DEPTH_VALUES = 99
|
||||||
_VERSION = "1.38.2"
|
_VERSION = "1.41.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version returns current package version literal.
|
// Version returns current package version literal.
|
||||||
|
@ -48,6 +48,10 @@ var (
|
||||||
// at package init time.
|
// at package init time.
|
||||||
LineBreak = "\n"
|
LineBreak = "\n"
|
||||||
|
|
||||||
|
// Place custom spaces when PrettyFormat and PrettyEqual are both disabled
|
||||||
|
DefaultFormatLeft = ""
|
||||||
|
DefaultFormatRight = ""
|
||||||
|
|
||||||
// Variable regexp pattern: %(variable)s
|
// Variable regexp pattern: %(variable)s
|
||||||
varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`)
|
varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`)
|
||||||
|
|
||||||
|
@ -164,6 +168,8 @@ type LoadOptions struct {
|
||||||
// UnparseableSections stores a list of blocks that are allowed with raw content which do not otherwise
|
// UnparseableSections stores a list of blocks that are allowed with raw content which do not otherwise
|
||||||
// conform to key/value pairs. Specify the names of those blocks here.
|
// conform to key/value pairs. Specify the names of those blocks here.
|
||||||
UnparseableSections []string
|
UnparseableSections []string
|
||||||
|
// KeyValueDelimiters is the sequence of delimiters that are used to separate key and value. By default, it is "=:".
|
||||||
|
KeyValueDelimiters string
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) {
|
func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) {
|
||||||
|
|
21
vendor/github.com/go-ini/ini/key.go
generated
vendored
21
vendor/github.com/go-ini/ini/key.go
generated
vendored
|
@ -133,8 +133,7 @@ func (k *Key) transformValue(val string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take off leading '%(' and trailing ')s'.
|
// Take off leading '%(' and trailing ')s'.
|
||||||
noption := strings.TrimLeft(vr, "%(")
|
noption := vr[2 : len(vr)-2]
|
||||||
noption = strings.TrimRight(noption, ")s")
|
|
||||||
|
|
||||||
// Search in the same section.
|
// Search in the same section.
|
||||||
nk, err := k.s.GetKey(noption)
|
nk, err := k.s.GetKey(noption)
|
||||||
|
@ -187,23 +186,24 @@ func (k *Key) Float64() (float64, error) {
|
||||||
|
|
||||||
// Int returns int type value.
|
// Int returns int type value.
|
||||||
func (k *Key) Int() (int, error) {
|
func (k *Key) Int() (int, error) {
|
||||||
return strconv.Atoi(k.String())
|
v, err := strconv.ParseInt(k.String(), 0, 64)
|
||||||
|
return int(v), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Int64 returns int64 type value.
|
// Int64 returns int64 type value.
|
||||||
func (k *Key) Int64() (int64, error) {
|
func (k *Key) Int64() (int64, error) {
|
||||||
return strconv.ParseInt(k.String(), 10, 64)
|
return strconv.ParseInt(k.String(), 0, 64)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint returns uint type valued.
|
// Uint returns uint type valued.
|
||||||
func (k *Key) Uint() (uint, error) {
|
func (k *Key) Uint() (uint, error) {
|
||||||
u, e := strconv.ParseUint(k.String(), 10, 64)
|
u, e := strconv.ParseUint(k.String(), 0, 64)
|
||||||
return uint(u), e
|
return uint(u), e
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint64 returns uint64 type value.
|
// Uint64 returns uint64 type value.
|
||||||
func (k *Key) Uint64() (uint64, error) {
|
func (k *Key) Uint64() (uint64, error) {
|
||||||
return strconv.ParseUint(k.String(), 10, 64)
|
return strconv.ParseUint(k.String(), 0, 64)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration returns time.Duration type value.
|
// Duration returns time.Duration type value.
|
||||||
|
@ -668,7 +668,8 @@ func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]
|
||||||
func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) {
|
func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) {
|
||||||
vals := make([]int, 0, len(strs))
|
vals := make([]int, 0, len(strs))
|
||||||
for _, str := range strs {
|
for _, str := range strs {
|
||||||
val, err := strconv.Atoi(str)
|
valInt64, err := strconv.ParseInt(str, 0, 64)
|
||||||
|
val := int(valInt64)
|
||||||
if err != nil && returnOnInvalid {
|
if err != nil && returnOnInvalid {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -683,7 +684,7 @@ func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int,
|
||||||
func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) {
|
func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) {
|
||||||
vals := make([]int64, 0, len(strs))
|
vals := make([]int64, 0, len(strs))
|
||||||
for _, str := range strs {
|
for _, str := range strs {
|
||||||
val, err := strconv.ParseInt(str, 10, 64)
|
val, err := strconv.ParseInt(str, 0, 64)
|
||||||
if err != nil && returnOnInvalid {
|
if err != nil && returnOnInvalid {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -698,7 +699,7 @@ func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]in
|
||||||
func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) {
|
func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) {
|
||||||
vals := make([]uint, 0, len(strs))
|
vals := make([]uint, 0, len(strs))
|
||||||
for _, str := range strs {
|
for _, str := range strs {
|
||||||
val, err := strconv.ParseUint(str, 10, 0)
|
val, err := strconv.ParseUint(str, 0, 0)
|
||||||
if err != nil && returnOnInvalid {
|
if err != nil && returnOnInvalid {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -713,7 +714,7 @@ func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uin
|
||||||
func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]uint64, error) {
|
func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]uint64, error) {
|
||||||
vals := make([]uint64, 0, len(strs))
|
vals := make([]uint64, 0, len(strs))
|
||||||
for _, str := range strs {
|
for _, str := range strs {
|
||||||
val, err := strconv.ParseUint(str, 10, 64)
|
val, err := strconv.ParseUint(str, 0, 64)
|
||||||
if err != nil && returnOnInvalid {
|
if err != nil && returnOnInvalid {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
20
vendor/github.com/go-ini/ini/parser.go
generated
vendored
20
vendor/github.com/go-ini/ini/parser.go
generated
vendored
|
@ -100,7 +100,7 @@ func cleanComment(in []byte) ([]byte, bool) {
|
||||||
return in[i:], true
|
return in[i:], true
|
||||||
}
|
}
|
||||||
|
|
||||||
func readKeyName(in []byte) (string, int, error) {
|
func readKeyName(delimiters string, in []byte) (string, int, error) {
|
||||||
line := string(in)
|
line := string(in)
|
||||||
|
|
||||||
// Check if key name surrounded by quotes.
|
// Check if key name surrounded by quotes.
|
||||||
|
@ -127,7 +127,7 @@ func readKeyName(in []byte) (string, int, error) {
|
||||||
pos += startIdx
|
pos += startIdx
|
||||||
|
|
||||||
// Find key-value delimiter
|
// Find key-value delimiter
|
||||||
i := strings.IndexAny(line[pos+startIdx:], "=:")
|
i := strings.IndexAny(line[pos+startIdx:], delimiters)
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
return "", -1, ErrDelimiterNotFound{line}
|
return "", -1, ErrDelimiterNotFound{line}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ func readKeyName(in []byte) (string, int, error) {
|
||||||
return strings.TrimSpace(line[startIdx:pos]), endIdx + startIdx + 1, nil
|
return strings.TrimSpace(line[startIdx:pos]), endIdx + startIdx + 1, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
endIdx = strings.IndexAny(line, "=:")
|
endIdx = strings.IndexAny(line, delimiters)
|
||||||
if endIdx < 0 {
|
if endIdx < 0 {
|
||||||
return "", -1, ErrDelimiterNotFound{line}
|
return "", -1, ErrDelimiterNotFound{line}
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,6 @@ func (p *parser) readValue(in []byte,
|
||||||
parserBufferPeekResult, _ := p.buf.Peek(parserBufferSize)
|
parserBufferPeekResult, _ := p.buf.Peek(parserBufferSize)
|
||||||
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
|
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
|
||||||
|
|
||||||
identSize := -1
|
|
||||||
val := line
|
val := line
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
@ -290,12 +289,11 @@ func (p *parser) readValue(in []byte,
|
||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
currentIdentSize := len(peekMatches[1])
|
|
||||||
// NOTE: Return if not a python-ini multi-line value.
|
// NOTE: Return if not a python-ini multi-line value.
|
||||||
if currentIdentSize < 0 {
|
currentIdentSize := len(peekMatches[1])
|
||||||
|
if currentIdentSize <= 0 {
|
||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
identSize = currentIdentSize
|
|
||||||
|
|
||||||
// NOTE: Just advance the parser reader (buffer) in-sync with the peek buffer.
|
// NOTE: Just advance the parser reader (buffer) in-sync with the peek buffer.
|
||||||
_, err := p.readUntil('\n')
|
_, err := p.readUntil('\n')
|
||||||
|
@ -305,12 +303,6 @@ func (p *parser) readValue(in []byte,
|
||||||
|
|
||||||
val += fmt.Sprintf("\n%s", peekMatches[2])
|
val += fmt.Sprintf("\n%s", peekMatches[2])
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: If it was a Python multi-line value,
|
|
||||||
// return the appended value.
|
|
||||||
if identSize > 0 {
|
|
||||||
return val, nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return line, nil
|
return line, nil
|
||||||
|
@ -428,7 +420,7 @@ func (f *File) parse(reader io.Reader) (err error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
kname, offset, err := readKeyName(line)
|
kname, offset, err := readKeyName(f.options.KeyValueDelimiters, line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Treat as boolean key when desired, and whole line is key name.
|
// Treat as boolean key when desired, and whole line is key name.
|
||||||
if IsErrDelimiterNotFound(err) {
|
if IsErrDelimiterNotFound(err) {
|
||||||
|
|
1
vendor/github.com/go-ini/ini/section.go
generated
vendored
1
vendor/github.com/go-ini/ini/section.go
generated
vendored
|
@ -238,6 +238,7 @@ func (s *Section) DeleteKey(name string) {
|
||||||
if k == name {
|
if k == name {
|
||||||
s.keyList = append(s.keyList[:i], s.keyList[i+1:]...)
|
s.keyList = append(s.keyList[:i], s.keyList[i+1:]...)
|
||||||
delete(s.keys, name)
|
delete(s.keys, name)
|
||||||
|
delete(s.keysHash, name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/go-ini/ini/struct.go
generated
vendored
2
vendor/github.com/go-ini/ini/struct.go
generated
vendored
|
@ -180,7 +180,7 @@ func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim stri
|
||||||
case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||||
durationVal, err := key.Duration()
|
durationVal, err := key.Duration()
|
||||||
// Skip zero value
|
// Skip zero value
|
||||||
if err == nil && int(durationVal) > 0 {
|
if err == nil && uint64(durationVal) > 0 {
|
||||||
field.Set(reflect.ValueOf(durationVal))
|
field.Set(reflect.ValueOf(durationVal))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
1271
vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
generated
vendored
Normal file
1271
vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2812
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go
generated
vendored
Normal file
2812
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
872
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto
generated
vendored
Normal file
872
vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto
generated
vendored
Normal file
|
@ -0,0 +1,872 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
// Author: kenton@google.com (Kenton Varda)
|
||||||
|
// Based on original Protocol Buffers design by
|
||||||
|
// Sanjay Ghemawat, Jeff Dean, and others.
|
||||||
|
//
|
||||||
|
// The messages in this file describe the definitions found in .proto files.
|
||||||
|
// A valid .proto file can be translated directly to a FileDescriptorProto
|
||||||
|
// without any other information (e.g. without reading its imports).
|
||||||
|
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "DescriptorProtos";
|
||||||
|
option csharp_namespace = "Google.Protobuf.Reflection";
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
|
||||||
|
// descriptor.proto must be optimized for speed because reflection-based
|
||||||
|
// algorithms don't work during bootstrapping.
|
||||||
|
option optimize_for = SPEED;
|
||||||
|
|
||||||
|
// The protocol compiler can output a FileDescriptorSet containing the .proto
|
||||||
|
// files it parses.
|
||||||
|
message FileDescriptorSet {
|
||||||
|
repeated FileDescriptorProto file = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a complete .proto file.
|
||||||
|
message FileDescriptorProto {
|
||||||
|
optional string name = 1; // file name, relative to root of source tree
|
||||||
|
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
||||||
|
|
||||||
|
// Names of files imported by this file.
|
||||||
|
repeated string dependency = 3;
|
||||||
|
// Indexes of the public imported files in the dependency list above.
|
||||||
|
repeated int32 public_dependency = 10;
|
||||||
|
// Indexes of the weak imported files in the dependency list.
|
||||||
|
// For Google-internal migration only. Do not use.
|
||||||
|
repeated int32 weak_dependency = 11;
|
||||||
|
|
||||||
|
// All top-level definitions in this file.
|
||||||
|
repeated DescriptorProto message_type = 4;
|
||||||
|
repeated EnumDescriptorProto enum_type = 5;
|
||||||
|
repeated ServiceDescriptorProto service = 6;
|
||||||
|
repeated FieldDescriptorProto extension = 7;
|
||||||
|
|
||||||
|
optional FileOptions options = 8;
|
||||||
|
|
||||||
|
// This field contains optional information about the original source code.
|
||||||
|
// You may safely remove this entire field without harming runtime
|
||||||
|
// functionality of the descriptors -- the information is needed only by
|
||||||
|
// development tools.
|
||||||
|
optional SourceCodeInfo source_code_info = 9;
|
||||||
|
|
||||||
|
// The syntax of the proto file.
|
||||||
|
// The supported values are "proto2" and "proto3".
|
||||||
|
optional string syntax = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a message type.
|
||||||
|
message DescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
repeated FieldDescriptorProto field = 2;
|
||||||
|
repeated FieldDescriptorProto extension = 6;
|
||||||
|
|
||||||
|
repeated DescriptorProto nested_type = 3;
|
||||||
|
repeated EnumDescriptorProto enum_type = 4;
|
||||||
|
|
||||||
|
message ExtensionRange {
|
||||||
|
optional int32 start = 1;
|
||||||
|
optional int32 end = 2;
|
||||||
|
|
||||||
|
optional ExtensionRangeOptions options = 3;
|
||||||
|
}
|
||||||
|
repeated ExtensionRange extension_range = 5;
|
||||||
|
|
||||||
|
repeated OneofDescriptorProto oneof_decl = 8;
|
||||||
|
|
||||||
|
optional MessageOptions options = 7;
|
||||||
|
|
||||||
|
// Range of reserved tag numbers. Reserved tag numbers may not be used by
|
||||||
|
// fields or extension ranges in the same message. Reserved ranges may
|
||||||
|
// not overlap.
|
||||||
|
message ReservedRange {
|
||||||
|
optional int32 start = 1; // Inclusive.
|
||||||
|
optional int32 end = 2; // Exclusive.
|
||||||
|
}
|
||||||
|
repeated ReservedRange reserved_range = 9;
|
||||||
|
// Reserved field names, which may not be used by fields in the same message.
|
||||||
|
// A given name may only be reserved once.
|
||||||
|
repeated string reserved_name = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExtensionRangeOptions {
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a field within a message.
|
||||||
|
message FieldDescriptorProto {
|
||||||
|
enum Type {
|
||||||
|
// 0 is reserved for errors.
|
||||||
|
// Order is weird for historical reasons.
|
||||||
|
TYPE_DOUBLE = 1;
|
||||||
|
TYPE_FLOAT = 2;
|
||||||
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||||
|
// negative values are likely.
|
||||||
|
TYPE_INT64 = 3;
|
||||||
|
TYPE_UINT64 = 4;
|
||||||
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||||
|
// negative values are likely.
|
||||||
|
TYPE_INT32 = 5;
|
||||||
|
TYPE_FIXED64 = 6;
|
||||||
|
TYPE_FIXED32 = 7;
|
||||||
|
TYPE_BOOL = 8;
|
||||||
|
TYPE_STRING = 9;
|
||||||
|
// Tag-delimited aggregate.
|
||||||
|
// Group type is deprecated and not supported in proto3. However, Proto3
|
||||||
|
// implementations should still be able to parse the group wire format and
|
||||||
|
// treat group fields as unknown fields.
|
||||||
|
TYPE_GROUP = 10;
|
||||||
|
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
||||||
|
|
||||||
|
// New in version 2.
|
||||||
|
TYPE_BYTES = 12;
|
||||||
|
TYPE_UINT32 = 13;
|
||||||
|
TYPE_ENUM = 14;
|
||||||
|
TYPE_SFIXED32 = 15;
|
||||||
|
TYPE_SFIXED64 = 16;
|
||||||
|
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
||||||
|
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Label {
|
||||||
|
// 0 is reserved for errors
|
||||||
|
LABEL_OPTIONAL = 1;
|
||||||
|
LABEL_REQUIRED = 2;
|
||||||
|
LABEL_REPEATED = 3;
|
||||||
|
};
|
||||||
|
|
||||||
|
optional string name = 1;
|
||||||
|
optional int32 number = 3;
|
||||||
|
optional Label label = 4;
|
||||||
|
|
||||||
|
// If type_name is set, this need not be set. If both this and type_name
|
||||||
|
// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
|
||||||
|
optional Type type = 5;
|
||||||
|
|
||||||
|
// For message and enum types, this is the name of the type. If the name
|
||||||
|
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
|
||||||
|
// rules are used to find the type (i.e. first the nested types within this
|
||||||
|
// message are searched, then within the parent, on up to the root
|
||||||
|
// namespace).
|
||||||
|
optional string type_name = 6;
|
||||||
|
|
||||||
|
// For extensions, this is the name of the type being extended. It is
|
||||||
|
// resolved in the same manner as type_name.
|
||||||
|
optional string extendee = 2;
|
||||||
|
|
||||||
|
// For numeric types, contains the original text representation of the value.
|
||||||
|
// For booleans, "true" or "false".
|
||||||
|
// For strings, contains the default text contents (not escaped in any way).
|
||||||
|
// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
|
||||||
|
// TODO(kenton): Base-64 encode?
|
||||||
|
optional string default_value = 7;
|
||||||
|
|
||||||
|
// If set, gives the index of a oneof in the containing type's oneof_decl
|
||||||
|
// list. This field is a member of that oneof.
|
||||||
|
optional int32 oneof_index = 9;
|
||||||
|
|
||||||
|
// JSON name of this field. The value is set by protocol compiler. If the
|
||||||
|
// user has set a "json_name" option on this field, that option's value
|
||||||
|
// will be used. Otherwise, it's deduced from the field's name by converting
|
||||||
|
// it to camelCase.
|
||||||
|
optional string json_name = 10;
|
||||||
|
|
||||||
|
optional FieldOptions options = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a oneof.
|
||||||
|
message OneofDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
optional OneofOptions options = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes an enum type.
|
||||||
|
message EnumDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
repeated EnumValueDescriptorProto value = 2;
|
||||||
|
|
||||||
|
optional EnumOptions options = 3;
|
||||||
|
|
||||||
|
// Range of reserved numeric values. Reserved values may not be used by
|
||||||
|
// entries in the same enum. Reserved ranges may not overlap.
|
||||||
|
//
|
||||||
|
// Note that this is distinct from DescriptorProto.ReservedRange in that it
|
||||||
|
// is inclusive such that it can appropriately represent the entire int32
|
||||||
|
// domain.
|
||||||
|
message EnumReservedRange {
|
||||||
|
optional int32 start = 1; // Inclusive.
|
||||||
|
optional int32 end = 2; // Inclusive.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Range of reserved numeric values. Reserved numeric values may not be used
|
||||||
|
// by enum values in the same enum declaration. Reserved ranges may not
|
||||||
|
// overlap.
|
||||||
|
repeated EnumReservedRange reserved_range = 4;
|
||||||
|
|
||||||
|
// Reserved enum value names, which may not be reused. A given name may only
|
||||||
|
// be reserved once.
|
||||||
|
repeated string reserved_name = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a value within an enum.
|
||||||
|
message EnumValueDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
optional int32 number = 2;
|
||||||
|
|
||||||
|
optional EnumValueOptions options = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a service.
|
||||||
|
message ServiceDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
repeated MethodDescriptorProto method = 2;
|
||||||
|
|
||||||
|
optional ServiceOptions options = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a method of a service.
|
||||||
|
message MethodDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
// Input and output type names. These are resolved in the same way as
|
||||||
|
// FieldDescriptorProto.type_name, but must refer to a message type.
|
||||||
|
optional string input_type = 2;
|
||||||
|
optional string output_type = 3;
|
||||||
|
|
||||||
|
optional MethodOptions options = 4;
|
||||||
|
|
||||||
|
// Identifies if client streams multiple client messages
|
||||||
|
optional bool client_streaming = 5 [default=false];
|
||||||
|
// Identifies if server streams multiple server messages
|
||||||
|
optional bool server_streaming = 6 [default=false];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
// Options
|
||||||
|
|
||||||
|
// Each of the definitions above may have "options" attached. These are
|
||||||
|
// just annotations which may cause code to be generated slightly differently
|
||||||
|
// or may contain hints for code that manipulates protocol messages.
|
||||||
|
//
|
||||||
|
// Clients may define custom options as extensions of the *Options messages.
|
||||||
|
// These extensions may not yet be known at parsing time, so the parser cannot
|
||||||
|
// store the values in them. Instead it stores them in a field in the *Options
|
||||||
|
// message called uninterpreted_option. This field must have the same name
|
||||||
|
// across all *Options messages. We then use this field to populate the
|
||||||
|
// extensions when we build a descriptor, at which point all protos have been
|
||||||
|
// parsed and so all extensions are known.
|
||||||
|
//
|
||||||
|
// Extension numbers for custom options may be chosen as follows:
|
||||||
|
// * For options which will only be used within a single application or
|
||||||
|
// organization, or for experimental options, use field numbers 50000
|
||||||
|
// through 99999. It is up to you to ensure that you do not use the
|
||||||
|
// same number for multiple options.
|
||||||
|
// * For options which will be published and used publicly by multiple
|
||||||
|
// independent entities, e-mail protobuf-global-extension-registry@google.com
|
||||||
|
// to reserve extension numbers. Simply provide your project name (e.g.
|
||||||
|
// Objective-C plugin) and your project website (if available) -- there's no
|
||||||
|
// need to explain how you intend to use them. Usually you only need one
|
||||||
|
// extension number. You can declare multiple options with only one extension
|
||||||
|
// number by putting them in a sub-message. See the Custom Options section of
|
||||||
|
// the docs for examples:
|
||||||
|
// https://developers.google.com/protocol-buffers/docs/proto#options
|
||||||
|
// If this turns out to be popular, a web service will be set up
|
||||||
|
// to automatically assign option numbers.
|
||||||
|
|
||||||
|
|
||||||
|
message FileOptions {
|
||||||
|
|
||||||
|
// Sets the Java package where classes generated from this .proto will be
|
||||||
|
// placed. By default, the proto package is used, but this is often
|
||||||
|
// inappropriate because proto packages do not normally start with backwards
|
||||||
|
// domain names.
|
||||||
|
optional string java_package = 1;
|
||||||
|
|
||||||
|
|
||||||
|
// If set, all the classes from the .proto file are wrapped in a single
|
||||||
|
// outer class with the given name. This applies to both Proto1
|
||||||
|
// (equivalent to the old "--one_java_file" option) and Proto2 (where
|
||||||
|
// a .proto always translates to a single class, but you may want to
|
||||||
|
// explicitly choose the class name).
|
||||||
|
optional string java_outer_classname = 8;
|
||||||
|
|
||||||
|
// If set true, then the Java code generator will generate a separate .java
|
||||||
|
// file for each top-level message, enum, and service defined in the .proto
|
||||||
|
// file. Thus, these types will *not* be nested inside the outer class
|
||||||
|
// named by java_outer_classname. However, the outer class will still be
|
||||||
|
// generated to contain the file's getDescriptor() method as well as any
|
||||||
|
// top-level extensions defined in the file.
|
||||||
|
optional bool java_multiple_files = 10 [default=false];
|
||||||
|
|
||||||
|
// This option does nothing.
|
||||||
|
optional bool java_generate_equals_and_hash = 20 [deprecated=true];
|
||||||
|
|
||||||
|
// If set true, then the Java2 code generator will generate code that
|
||||||
|
// throws an exception whenever an attempt is made to assign a non-UTF-8
|
||||||
|
// byte sequence to a string field.
|
||||||
|
// Message reflection will do the same.
|
||||||
|
// However, an extension field still accepts non-UTF-8 byte sequences.
|
||||||
|
// This option has no effect on when used with the lite runtime.
|
||||||
|
optional bool java_string_check_utf8 = 27 [default=false];
|
||||||
|
|
||||||
|
|
||||||
|
// Generated classes can be optimized for speed or code size.
|
||||||
|
enum OptimizeMode {
|
||||||
|
SPEED = 1; // Generate complete code for parsing, serialization,
|
||||||
|
// etc.
|
||||||
|
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
||||||
|
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
||||||
|
}
|
||||||
|
optional OptimizeMode optimize_for = 9 [default=SPEED];
|
||||||
|
|
||||||
|
// Sets the Go package where structs generated from this .proto will be
|
||||||
|
// placed. If omitted, the Go package will be derived from the following:
|
||||||
|
// - The basename of the package import path, if provided.
|
||||||
|
// - Otherwise, the package statement in the .proto file, if present.
|
||||||
|
// - Otherwise, the basename of the .proto file, without extension.
|
||||||
|
optional string go_package = 11;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Should generic services be generated in each language? "Generic" services
|
||||||
|
// are not specific to any particular RPC system. They are generated by the
|
||||||
|
// main code generators in each language (without additional plugins).
|
||||||
|
// Generic services were the only kind of service generation supported by
|
||||||
|
// early versions of google.protobuf.
|
||||||
|
//
|
||||||
|
// Generic services are now considered deprecated in favor of using plugins
|
||||||
|
// that generate code specific to your particular RPC system. Therefore,
|
||||||
|
// these default to false. Old code which depends on generic services should
|
||||||
|
// explicitly set them to true.
|
||||||
|
optional bool cc_generic_services = 16 [default=false];
|
||||||
|
optional bool java_generic_services = 17 [default=false];
|
||||||
|
optional bool py_generic_services = 18 [default=false];
|
||||||
|
optional bool php_generic_services = 42 [default=false];
|
||||||
|
|
||||||
|
// Is this file deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for everything in the file, or it will be completely ignored; in the very
|
||||||
|
// least, this is a formalization for deprecating files.
|
||||||
|
optional bool deprecated = 23 [default=false];
|
||||||
|
|
||||||
|
// Enables the use of arenas for the proto messages in this file. This applies
|
||||||
|
// only to generated classes for C++.
|
||||||
|
optional bool cc_enable_arenas = 31 [default=false];
|
||||||
|
|
||||||
|
|
||||||
|
// Sets the objective c class prefix which is prepended to all objective c
|
||||||
|
// generated classes from this .proto. There is no default.
|
||||||
|
optional string objc_class_prefix = 36;
|
||||||
|
|
||||||
|
// Namespace for generated classes; defaults to the package.
|
||||||
|
optional string csharp_namespace = 37;
|
||||||
|
|
||||||
|
// By default Swift generators will take the proto package and CamelCase it
|
||||||
|
// replacing '.' with underscore and use that to prefix the types/symbols
|
||||||
|
// defined. When this options is provided, they will use this value instead
|
||||||
|
// to prefix the types/symbols defined.
|
||||||
|
optional string swift_prefix = 39;
|
||||||
|
|
||||||
|
// Sets the php class prefix which is prepended to all php generated classes
|
||||||
|
// from this .proto. Default is empty.
|
||||||
|
optional string php_class_prefix = 40;
|
||||||
|
|
||||||
|
// Use this option to change the namespace of php generated classes. Default
|
||||||
|
// is empty. When this option is empty, the package name will be used for
|
||||||
|
// determining the namespace.
|
||||||
|
optional string php_namespace = 41;
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here.
|
||||||
|
// See the documentation for the "Options" section above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message.
|
||||||
|
// See the documentation for the "Options" section above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
|
||||||
|
reserved 38;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MessageOptions {
|
||||||
|
// Set true to use the old proto1 MessageSet wire format for extensions.
|
||||||
|
// This is provided for backwards-compatibility with the MessageSet wire
|
||||||
|
// format. You should not use this for any other reason: It's less
|
||||||
|
// efficient, has fewer features, and is more complicated.
|
||||||
|
//
|
||||||
|
// The message must be defined exactly as follows:
|
||||||
|
// message Foo {
|
||||||
|
// option message_set_wire_format = true;
|
||||||
|
// extensions 4 to max;
|
||||||
|
// }
|
||||||
|
// Note that the message cannot have any defined fields; MessageSets only
|
||||||
|
// have extensions.
|
||||||
|
//
|
||||||
|
// All extensions of your type must be singular messages; e.g. they cannot
|
||||||
|
// be int32s, enums, or repeated messages.
|
||||||
|
//
|
||||||
|
// Because this is an option, the above two restrictions are not enforced by
|
||||||
|
// the protocol compiler.
|
||||||
|
optional bool message_set_wire_format = 1 [default=false];
|
||||||
|
|
||||||
|
// Disables the generation of the standard "descriptor()" accessor, which can
|
||||||
|
// conflict with a field of the same name. This is meant to make migration
|
||||||
|
// from proto1 easier; new code should avoid fields named "descriptor".
|
||||||
|
optional bool no_standard_descriptor_accessor = 2 [default=false];
|
||||||
|
|
||||||
|
// Is this message deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the message, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating messages.
|
||||||
|
optional bool deprecated = 3 [default=false];
|
||||||
|
|
||||||
|
// Whether the message is an automatically generated map entry type for the
|
||||||
|
// maps field.
|
||||||
|
//
|
||||||
|
// For maps fields:
|
||||||
|
// map<KeyType, ValueType> map_field = 1;
|
||||||
|
// The parsed descriptor looks like:
|
||||||
|
// message MapFieldEntry {
|
||||||
|
// option map_entry = true;
|
||||||
|
// optional KeyType key = 1;
|
||||||
|
// optional ValueType value = 2;
|
||||||
|
// }
|
||||||
|
// repeated MapFieldEntry map_field = 1;
|
||||||
|
//
|
||||||
|
// Implementations may choose not to generate the map_entry=true message, but
|
||||||
|
// use a native map in the target language to hold the keys and values.
|
||||||
|
// The reflection APIs in such implementions still need to work as
|
||||||
|
// if the field is a repeated message field.
|
||||||
|
//
|
||||||
|
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||||
|
// instead. The option should only be implicitly set by the proto compiler
|
||||||
|
// parser.
|
||||||
|
optional bool map_entry = 7;
|
||||||
|
|
||||||
|
reserved 8; // javalite_serializable
|
||||||
|
reserved 9; // javanano_as_lite
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FieldOptions {
|
||||||
|
// The ctype option instructs the C++ code generator to use a different
|
||||||
|
// representation of the field than it normally would. See the specific
|
||||||
|
// options below. This option is not yet implemented in the open source
|
||||||
|
// release -- sorry, we'll try to include it in a future version!
|
||||||
|
optional CType ctype = 1 [default = STRING];
|
||||||
|
enum CType {
|
||||||
|
// Default mode.
|
||||||
|
STRING = 0;
|
||||||
|
|
||||||
|
CORD = 1;
|
||||||
|
|
||||||
|
STRING_PIECE = 2;
|
||||||
|
}
|
||||||
|
// The packed option can be enabled for repeated primitive fields to enable
|
||||||
|
// a more efficient representation on the wire. Rather than repeatedly
|
||||||
|
// writing the tag and type for each element, the entire array is encoded as
|
||||||
|
// a single length-delimited blob. In proto3, only explicit setting it to
|
||||||
|
// false will avoid using packed encoding.
|
||||||
|
optional bool packed = 2;
|
||||||
|
|
||||||
|
// The jstype option determines the JavaScript type used for values of the
|
||||||
|
// field. The option is permitted only for 64 bit integral and fixed types
|
||||||
|
// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
|
||||||
|
// is represented as JavaScript string, which avoids loss of precision that
|
||||||
|
// can happen when a large value is converted to a floating point JavaScript.
|
||||||
|
// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
|
||||||
|
// use the JavaScript "number" type. The behavior of the default option
|
||||||
|
// JS_NORMAL is implementation dependent.
|
||||||
|
//
|
||||||
|
// This option is an enum to permit additional types to be added, e.g.
|
||||||
|
// goog.math.Integer.
|
||||||
|
optional JSType jstype = 6 [default = JS_NORMAL];
|
||||||
|
enum JSType {
|
||||||
|
// Use the default type.
|
||||||
|
JS_NORMAL = 0;
|
||||||
|
|
||||||
|
// Use JavaScript strings.
|
||||||
|
JS_STRING = 1;
|
||||||
|
|
||||||
|
// Use JavaScript numbers.
|
||||||
|
JS_NUMBER = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should this field be parsed lazily? Lazy applies only to message-type
|
||||||
|
// fields. It means that when the outer message is initially parsed, the
|
||||||
|
// inner message's contents will not be parsed but instead stored in encoded
|
||||||
|
// form. The inner message will actually be parsed when it is first accessed.
|
||||||
|
//
|
||||||
|
// This is only a hint. Implementations are free to choose whether to use
|
||||||
|
// eager or lazy parsing regardless of the value of this option. However,
|
||||||
|
// setting this option true suggests that the protocol author believes that
|
||||||
|
// using lazy parsing on this field is worth the additional bookkeeping
|
||||||
|
// overhead typically needed to implement it.
|
||||||
|
//
|
||||||
|
// This option does not affect the public interface of any generated code;
|
||||||
|
// all method signatures remain the same. Furthermore, thread-safety of the
|
||||||
|
// interface is not affected by this option; const methods remain safe to
|
||||||
|
// call from multiple threads concurrently, while non-const methods continue
|
||||||
|
// to require exclusive access.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Note that implementations may choose not to check required fields within
|
||||||
|
// a lazy sub-message. That is, calling IsInitialized() on the outer message
|
||||||
|
// may return true even if the inner message has missing required fields.
|
||||||
|
// This is necessary because otherwise the inner message would have to be
|
||||||
|
// parsed in order to perform the check, defeating the purpose of lazy
|
||||||
|
// parsing. An implementation which chooses not to check required fields
|
||||||
|
// must be consistent about it. That is, for any particular sub-message, the
|
||||||
|
// implementation must either *always* check its required fields, or *never*
|
||||||
|
// check its required fields, regardless of whether or not the message has
|
||||||
|
// been parsed.
|
||||||
|
optional bool lazy = 5 [default=false];
|
||||||
|
|
||||||
|
// Is this field deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for accessors, or it will be completely ignored; in the very least, this
|
||||||
|
// is a formalization for deprecating fields.
|
||||||
|
optional bool deprecated = 3 [default=false];
|
||||||
|
|
||||||
|
// For Google-internal migration only. Do not use.
|
||||||
|
optional bool weak = 10 [default=false];
|
||||||
|
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
|
||||||
|
reserved 4; // removed jtype
|
||||||
|
}
|
||||||
|
|
||||||
|
message OneofOptions {
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EnumOptions {
|
||||||
|
|
||||||
|
// Set this option to true to allow mapping different tag names to the same
|
||||||
|
// value.
|
||||||
|
optional bool allow_alias = 2;
|
||||||
|
|
||||||
|
// Is this enum deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the enum, or it will be completely ignored; in the very least, this
|
||||||
|
// is a formalization for deprecating enums.
|
||||||
|
optional bool deprecated = 3 [default=false];
|
||||||
|
|
||||||
|
reserved 5; // javanano_as_lite
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EnumValueOptions {
|
||||||
|
// Is this enum value deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the enum value, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating enum values.
|
||||||
|
optional bool deprecated = 1 [default=false];
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ServiceOptions {
|
||||||
|
|
||||||
|
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||||
|
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||||
|
// we were already using them long before we decided to release Protocol
|
||||||
|
// Buffers.
|
||||||
|
|
||||||
|
// Is this service deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the service, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating services.
|
||||||
|
optional bool deprecated = 33 [default=false];
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MethodOptions {
|
||||||
|
|
||||||
|
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||||
|
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||||
|
// we were already using them long before we decided to release Protocol
|
||||||
|
// Buffers.
|
||||||
|
|
||||||
|
// Is this method deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the method, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating methods.
|
||||||
|
optional bool deprecated = 33 [default=false];
|
||||||
|
|
||||||
|
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
|
||||||
|
// or neither? HTTP based RPC implementation may choose GET verb for safe
|
||||||
|
// methods, and PUT verb for idempotent methods instead of the default POST.
|
||||||
|
enum IdempotencyLevel {
|
||||||
|
IDEMPOTENCY_UNKNOWN = 0;
|
||||||
|
NO_SIDE_EFFECTS = 1; // implies idempotent
|
||||||
|
IDEMPOTENT = 2; // idempotent, but may have side effects
|
||||||
|
}
|
||||||
|
optional IdempotencyLevel idempotency_level =
|
||||||
|
34 [default=IDEMPOTENCY_UNKNOWN];
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// A message representing a option the parser does not recognize. This only
|
||||||
|
// appears in options protos created by the compiler::Parser class.
|
||||||
|
// DescriptorPool resolves these when building Descriptor objects. Therefore,
|
||||||
|
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
|
||||||
|
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
|
||||||
|
// in them.
|
||||||
|
message UninterpretedOption {
|
||||||
|
// The name of the uninterpreted option. Each string represents a segment in
|
||||||
|
// a dot-separated name. is_extension is true iff a segment represents an
|
||||||
|
// extension (denoted with parentheses in options specs in .proto files).
|
||||||
|
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
|
||||||
|
// "foo.(bar.baz).qux".
|
||||||
|
message NamePart {
|
||||||
|
required string name_part = 1;
|
||||||
|
required bool is_extension = 2;
|
||||||
|
}
|
||||||
|
repeated NamePart name = 2;
|
||||||
|
|
||||||
|
// The value of the uninterpreted option, in whatever type the tokenizer
|
||||||
|
// identified it as during parsing. Exactly one of these should be set.
|
||||||
|
optional string identifier_value = 3;
|
||||||
|
optional uint64 positive_int_value = 4;
|
||||||
|
optional int64 negative_int_value = 5;
|
||||||
|
optional double double_value = 6;
|
||||||
|
optional bytes string_value = 7;
|
||||||
|
optional string aggregate_value = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
// Optional source code info
|
||||||
|
|
||||||
|
// Encapsulates information about the original source file from which a
|
||||||
|
// FileDescriptorProto was generated.
|
||||||
|
message SourceCodeInfo {
|
||||||
|
// A Location identifies a piece of source code in a .proto file which
|
||||||
|
// corresponds to a particular definition. This information is intended
|
||||||
|
// to be useful to IDEs, code indexers, documentation generators, and similar
|
||||||
|
// tools.
|
||||||
|
//
|
||||||
|
// For example, say we have a file like:
|
||||||
|
// message Foo {
|
||||||
|
// optional string foo = 1;
|
||||||
|
// }
|
||||||
|
// Let's look at just the field definition:
|
||||||
|
// optional string foo = 1;
|
||||||
|
// ^ ^^ ^^ ^ ^^^
|
||||||
|
// a bc de f ghi
|
||||||
|
// We have the following locations:
|
||||||
|
// span path represents
|
||||||
|
// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
|
||||||
|
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
|
||||||
|
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
|
||||||
|
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
|
||||||
|
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
// - A location may refer to a repeated field itself (i.e. not to any
|
||||||
|
// particular index within it). This is used whenever a set of elements are
|
||||||
|
// logically enclosed in a single code segment. For example, an entire
|
||||||
|
// extend block (possibly containing multiple extension definitions) will
|
||||||
|
// have an outer location whose path refers to the "extensions" repeated
|
||||||
|
// field without an index.
|
||||||
|
// - Multiple locations may have the same path. This happens when a single
|
||||||
|
// logical declaration is spread out across multiple places. The most
|
||||||
|
// obvious example is the "extend" block again -- there may be multiple
|
||||||
|
// extend blocks in the same scope, each of which will have the same path.
|
||||||
|
// - A location's span is not always a subset of its parent's span. For
|
||||||
|
// example, the "extendee" of an extension declaration appears at the
|
||||||
|
// beginning of the "extend" block and is shared by all extensions within
|
||||||
|
// the block.
|
||||||
|
// - Just because a location's span is a subset of some other location's span
|
||||||
|
// does not mean that it is a descendent. For example, a "group" defines
|
||||||
|
// both a type and a field in a single declaration. Thus, the locations
|
||||||
|
// corresponding to the type and field and their components will overlap.
|
||||||
|
// - Code which tries to interpret locations should probably be designed to
|
||||||
|
// ignore those that it doesn't understand, as more types of locations could
|
||||||
|
// be recorded in the future.
|
||||||
|
repeated Location location = 1;
|
||||||
|
message Location {
|
||||||
|
// Identifies which part of the FileDescriptorProto was defined at this
|
||||||
|
// location.
|
||||||
|
//
|
||||||
|
// Each element is a field number or an index. They form a path from
|
||||||
|
// the root FileDescriptorProto to the place where the definition. For
|
||||||
|
// example, this path:
|
||||||
|
// [ 4, 3, 2, 7, 1 ]
|
||||||
|
// refers to:
|
||||||
|
// file.message_type(3) // 4, 3
|
||||||
|
// .field(7) // 2, 7
|
||||||
|
// .name() // 1
|
||||||
|
// This is because FileDescriptorProto.message_type has field number 4:
|
||||||
|
// repeated DescriptorProto message_type = 4;
|
||||||
|
// and DescriptorProto.field has field number 2:
|
||||||
|
// repeated FieldDescriptorProto field = 2;
|
||||||
|
// and FieldDescriptorProto.name has field number 1:
|
||||||
|
// optional string name = 1;
|
||||||
|
//
|
||||||
|
// Thus, the above path gives the location of a field name. If we removed
|
||||||
|
// the last element:
|
||||||
|
// [ 4, 3, 2, 7 ]
|
||||||
|
// this path refers to the whole field declaration (from the beginning
|
||||||
|
// of the label to the terminating semicolon).
|
||||||
|
repeated int32 path = 1 [packed=true];
|
||||||
|
|
||||||
|
// Always has exactly three or four elements: start line, start column,
|
||||||
|
// end line (optional, otherwise assumed same as start line), end column.
|
||||||
|
// These are packed into a single field for efficiency. Note that line
|
||||||
|
// and column numbers are zero-based -- typically you will want to add
|
||||||
|
// 1 to each before displaying to a user.
|
||||||
|
repeated int32 span = 2 [packed=true];
|
||||||
|
|
||||||
|
// If this SourceCodeInfo represents a complete declaration, these are any
|
||||||
|
// comments appearing before and after the declaration which appear to be
|
||||||
|
// attached to the declaration.
|
||||||
|
//
|
||||||
|
// A series of line comments appearing on consecutive lines, with no other
|
||||||
|
// tokens appearing on those lines, will be treated as a single comment.
|
||||||
|
//
|
||||||
|
// leading_detached_comments will keep paragraphs of comments that appear
|
||||||
|
// before (but not connected to) the current element. Each paragraph,
|
||||||
|
// separated by empty lines, will be one comment element in the repeated
|
||||||
|
// field.
|
||||||
|
//
|
||||||
|
// Only the comment content is provided; comment markers (e.g. //) are
|
||||||
|
// stripped out. For block comments, leading whitespace and an asterisk
|
||||||
|
// will be stripped from the beginning of each line other than the first.
|
||||||
|
// Newlines are included in the output.
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
//
|
||||||
|
// optional int32 foo = 1; // Comment attached to foo.
|
||||||
|
// // Comment attached to bar.
|
||||||
|
// optional int32 bar = 2;
|
||||||
|
//
|
||||||
|
// optional string baz = 3;
|
||||||
|
// // Comment attached to baz.
|
||||||
|
// // Another line attached to baz.
|
||||||
|
//
|
||||||
|
// // Comment attached to qux.
|
||||||
|
// //
|
||||||
|
// // Another line attached to qux.
|
||||||
|
// optional double qux = 4;
|
||||||
|
//
|
||||||
|
// // Detached comment for corge. This is not leading or trailing comments
|
||||||
|
// // to qux or corge because there are blank lines separating it from
|
||||||
|
// // both.
|
||||||
|
//
|
||||||
|
// // Detached comment for corge paragraph 2.
|
||||||
|
//
|
||||||
|
// optional string corge = 5;
|
||||||
|
// /* Block comment attached
|
||||||
|
// * to corge. Leading asterisks
|
||||||
|
// * will be removed. */
|
||||||
|
// /* Block comment attached to
|
||||||
|
// * grault. */
|
||||||
|
// optional int32 grault = 6;
|
||||||
|
//
|
||||||
|
// // ignored detached comments.
|
||||||
|
optional string leading_comments = 3;
|
||||||
|
optional string trailing_comments = 4;
|
||||||
|
repeated string leading_detached_comments = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes the relationship between generated code and its original source
|
||||||
|
// file. A GeneratedCodeInfo message is associated with only one generated
|
||||||
|
// source file, but may contain references to different source .proto files.
|
||||||
|
message GeneratedCodeInfo {
|
||||||
|
// An Annotation connects some span of text in generated code to an element
|
||||||
|
// of its generating .proto file.
|
||||||
|
repeated Annotation annotation = 1;
|
||||||
|
message Annotation {
|
||||||
|
// Identifies the element in the original source .proto file. This field
|
||||||
|
// is formatted the same as SourceCodeInfo.Location.path.
|
||||||
|
repeated int32 path = 1 [packed=true];
|
||||||
|
|
||||||
|
// Identifies the filesystem path to the original source .proto.
|
||||||
|
optional string source_file = 2;
|
||||||
|
|
||||||
|
// Identifies the starting offset in bytes in the generated code
|
||||||
|
// that relates to the identified object.
|
||||||
|
optional int32 begin = 3;
|
||||||
|
|
||||||
|
// Identifies the ending offset in bytes in the generated code that
|
||||||
|
// relates to the identified offset. The end offset should be one past
|
||||||
|
// the last relevant byte (so the length of the text = end - begin).
|
||||||
|
optional int32 end = 4;
|
||||||
|
}
|
||||||
|
}
|
3086
vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go
generated
vendored
Normal file
3086
vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
117
vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go
generated
vendored
Normal file
117
vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
// Go support for Protocol Buffers - Google's data interchange format
|
||||||
|
//
|
||||||
|
// Copyright 2017 The Go Authors. All rights reserved.
|
||||||
|
// https://github.com/golang/protobuf
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package remap handles tracking the locations of Go tokens in a source text
|
||||||
|
across a rewrite by the Go formatter.
|
||||||
|
*/
|
||||||
|
package remap
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/scanner"
|
||||||
|
"go/token"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A Location represents a span of byte offsets in the source text.
|
||||||
|
type Location struct {
|
||||||
|
Pos, End int // End is exclusive
|
||||||
|
}
|
||||||
|
|
||||||
|
// A Map represents a mapping between token locations in an input source text
|
||||||
|
// and locations in the correspnding output text.
|
||||||
|
type Map map[Location]Location
|
||||||
|
|
||||||
|
// Find reports whether the specified span is recorded by m, and if so returns
|
||||||
|
// the new location it was mapped to. If the input span was not found, the
|
||||||
|
// returned location is the same as the input.
|
||||||
|
func (m Map) Find(pos, end int) (Location, bool) {
|
||||||
|
key := Location{
|
||||||
|
Pos: pos,
|
||||||
|
End: end,
|
||||||
|
}
|
||||||
|
if loc, ok := m[key]; ok {
|
||||||
|
return loc, true
|
||||||
|
}
|
||||||
|
return key, false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Map) add(opos, oend, npos, nend int) {
|
||||||
|
m[Location{Pos: opos, End: oend}] = Location{Pos: npos, End: nend}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute constructs a location mapping from input to output. An error is
|
||||||
|
// reported if any of the tokens of output cannot be mapped.
|
||||||
|
func Compute(input, output []byte) (Map, error) {
|
||||||
|
itok := tokenize(input)
|
||||||
|
otok := tokenize(output)
|
||||||
|
if len(itok) != len(otok) {
|
||||||
|
return nil, fmt.Errorf("wrong number of tokens, %d ≠ %d", len(itok), len(otok))
|
||||||
|
}
|
||||||
|
m := make(Map)
|
||||||
|
for i, ti := range itok {
|
||||||
|
to := otok[i]
|
||||||
|
if ti.Token != to.Token {
|
||||||
|
return nil, fmt.Errorf("token %d type mismatch: %s ≠ %s", i+1, ti, to)
|
||||||
|
}
|
||||||
|
m.add(ti.pos, ti.end, to.pos, to.end)
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// tokinfo records the span and type of a source token.
|
||||||
|
type tokinfo struct {
|
||||||
|
pos, end int
|
||||||
|
token.Token
|
||||||
|
}
|
||||||
|
|
||||||
|
func tokenize(src []byte) []tokinfo {
|
||||||
|
fs := token.NewFileSet()
|
||||||
|
var s scanner.Scanner
|
||||||
|
s.Init(fs.AddFile("src", fs.Base(), len(src)), src, nil, scanner.ScanComments)
|
||||||
|
var info []tokinfo
|
||||||
|
for {
|
||||||
|
pos, next, lit := s.Scan()
|
||||||
|
switch next {
|
||||||
|
case token.SEMICOLON:
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
info = append(info, tokinfo{
|
||||||
|
pos: int(pos - 1),
|
||||||
|
end: int(pos + token.Pos(len(lit)) - 1),
|
||||||
|
Token: next,
|
||||||
|
})
|
||||||
|
if next == token.EOF {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return info
|
||||||
|
}
|
369
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go
generated
vendored
Normal file
369
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,369 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google/protobuf/compiler/plugin.proto
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package plugin_go is a generated protocol buffer package.
|
||||||
|
|
||||||
|
It is generated from these files:
|
||||||
|
google/protobuf/compiler/plugin.proto
|
||||||
|
|
||||||
|
It has these top-level messages:
|
||||||
|
Version
|
||||||
|
CodeGeneratorRequest
|
||||||
|
CodeGeneratorResponse
|
||||||
|
*/
|
||||||
|
package plugin_go
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// The version number of protocol compiler.
|
||||||
|
type Version struct {
|
||||||
|
Major *int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"`
|
||||||
|
Minor *int32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"`
|
||||||
|
Patch *int32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"`
|
||||||
|
// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
|
||||||
|
// be empty for mainline stable releases.
|
||||||
|
Suffix *string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Version) Reset() { *m = Version{} }
|
||||||
|
func (m *Version) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Version) ProtoMessage() {}
|
||||||
|
func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||||
|
func (m *Version) Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Version.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Version) Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Version.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Version) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Version.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Version) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Version.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Version) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Version.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Version proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Version) GetMajor() int32 {
|
||||||
|
if m != nil && m.Major != nil {
|
||||||
|
return *m.Major
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Version) GetMinor() int32 {
|
||||||
|
if m != nil && m.Minor != nil {
|
||||||
|
return *m.Minor
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Version) GetPatch() int32 {
|
||||||
|
if m != nil && m.Patch != nil {
|
||||||
|
return *m.Patch
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Version) GetSuffix() string {
|
||||||
|
if m != nil && m.Suffix != nil {
|
||||||
|
return *m.Suffix
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
||||||
|
type CodeGeneratorRequest struct {
|
||||||
|
// The .proto files that were explicitly listed on the command-line. The
|
||||||
|
// code generator should generate code only for these files. Each file's
|
||||||
|
// descriptor will be included in proto_file, below.
|
||||||
|
FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate,json=fileToGenerate" json:"file_to_generate,omitempty"`
|
||||||
|
// The generator parameter passed on the command-line.
|
||||||
|
Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"`
|
||||||
|
// FileDescriptorProtos for all files in files_to_generate and everything
|
||||||
|
// they import. The files will appear in topological order, so each file
|
||||||
|
// appears before any file that imports it.
|
||||||
|
//
|
||||||
|
// protoc guarantees that all proto_files will be written after
|
||||||
|
// the fields above, even though this is not technically guaranteed by the
|
||||||
|
// protobuf wire format. This theoretically could allow a plugin to stream
|
||||||
|
// in the FileDescriptorProtos and handle them one by one rather than read
|
||||||
|
// the entire set into memory at once. However, as of this writing, this
|
||||||
|
// is not similarly optimized on protoc's end -- it will store all fields in
|
||||||
|
// memory at once before sending them to the plugin.
|
||||||
|
//
|
||||||
|
// Type names of fields and extensions in the FileDescriptorProto are always
|
||||||
|
// fully qualified.
|
||||||
|
ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"`
|
||||||
|
// The version number of protocol compiler.
|
||||||
|
CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} }
|
||||||
|
func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CodeGeneratorRequest) ProtoMessage() {}
|
||||||
|
func (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||||
|
func (m *CodeGeneratorRequest) Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CodeGeneratorRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorRequest) Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CodeGeneratorRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CodeGeneratorRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CodeGeneratorRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CodeGeneratorRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CodeGeneratorRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CodeGeneratorRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CodeGeneratorRequest) GetFileToGenerate() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.FileToGenerate
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorRequest) GetParameter() string {
|
||||||
|
if m != nil && m.Parameter != nil {
|
||||||
|
return *m.Parameter
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto {
|
||||||
|
if m != nil {
|
||||||
|
return m.ProtoFile
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorRequest) GetCompilerVersion() *Version {
|
||||||
|
if m != nil {
|
||||||
|
return m.CompilerVersion
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// The plugin writes an encoded CodeGeneratorResponse to stdout.
|
||||||
|
type CodeGeneratorResponse struct {
|
||||||
|
// Error message. If non-empty, code generation failed. The plugin process
|
||||||
|
// should exit with status code zero even if it reports an error in this way.
|
||||||
|
//
|
||||||
|
// This should be used to indicate errors in .proto files which prevent the
|
||||||
|
// code generator from generating correct code. Errors which indicate a
|
||||||
|
// problem in protoc itself -- such as the input CodeGeneratorRequest being
|
||||||
|
// unparseable -- should be reported by writing a message to stderr and
|
||||||
|
// exiting with a non-zero status code.
|
||||||
|
Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
|
||||||
|
File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} }
|
||||||
|
func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CodeGeneratorResponse) ProtoMessage() {}
|
||||||
|
func (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||||
|
func (m *CodeGeneratorResponse) Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CodeGeneratorResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorResponse) Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CodeGeneratorResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CodeGeneratorResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CodeGeneratorResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CodeGeneratorResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CodeGeneratorResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CodeGeneratorResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CodeGeneratorResponse) GetError() string {
|
||||||
|
if m != nil && m.Error != nil {
|
||||||
|
return *m.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File {
|
||||||
|
if m != nil {
|
||||||
|
return m.File
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Represents a single generated file.
|
||||||
|
type CodeGeneratorResponse_File struct {
|
||||||
|
// The file name, relative to the output directory. The name must not
|
||||||
|
// contain "." or ".." components and must be relative, not be absolute (so,
|
||||||
|
// the file cannot lie outside the output directory). "/" must be used as
|
||||||
|
// the path separator, not "\".
|
||||||
|
//
|
||||||
|
// If the name is omitted, the content will be appended to the previous
|
||||||
|
// file. This allows the generator to break large files into small chunks,
|
||||||
|
// and allows the generated text to be streamed back to protoc so that large
|
||||||
|
// files need not reside completely in memory at one time. Note that as of
|
||||||
|
// this writing protoc does not optimize for this -- it will read the entire
|
||||||
|
// CodeGeneratorResponse before writing files to disk.
|
||||||
|
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||||
|
// If non-empty, indicates that the named file should already exist, and the
|
||||||
|
// content here is to be inserted into that file at a defined insertion
|
||||||
|
// point. This feature allows a code generator to extend the output
|
||||||
|
// produced by another code generator. The original generator may provide
|
||||||
|
// insertion points by placing special annotations in the file that look
|
||||||
|
// like:
|
||||||
|
// @@protoc_insertion_point(NAME)
|
||||||
|
// The annotation can have arbitrary text before and after it on the line,
|
||||||
|
// which allows it to be placed in a comment. NAME should be replaced with
|
||||||
|
// an identifier naming the point -- this is what other generators will use
|
||||||
|
// as the insertion_point. Code inserted at this point will be placed
|
||||||
|
// immediately above the line containing the insertion point (thus multiple
|
||||||
|
// insertions to the same point will come out in the order they were added).
|
||||||
|
// The double-@ is intended to make it unlikely that the generated code
|
||||||
|
// could contain things that look like insertion points by accident.
|
||||||
|
//
|
||||||
|
// For example, the C++ code generator places the following line in the
|
||||||
|
// .pb.h files that it generates:
|
||||||
|
// // @@protoc_insertion_point(namespace_scope)
|
||||||
|
// This line appears within the scope of the file's package namespace, but
|
||||||
|
// outside of any particular class. Another plugin can then specify the
|
||||||
|
// insertion_point "namespace_scope" to generate additional classes or
|
||||||
|
// other declarations that should be placed in this scope.
|
||||||
|
//
|
||||||
|
// Note that if the line containing the insertion point begins with
|
||||||
|
// whitespace, the same whitespace will be added to every line of the
|
||||||
|
// inserted text. This is useful for languages like Python, where
|
||||||
|
// indentation matters. In these languages, the insertion point comment
|
||||||
|
// should be indented the same amount as any inserted code will need to be
|
||||||
|
// in order to work correctly in that context.
|
||||||
|
//
|
||||||
|
// The code generator that generates the initial file and the one which
|
||||||
|
// inserts into it must both run as part of a single invocation of protoc.
|
||||||
|
// Code generators are executed in the order in which they appear on the
|
||||||
|
// command line.
|
||||||
|
//
|
||||||
|
// If |insertion_point| is present, |name| must also be present.
|
||||||
|
InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point,json=insertionPoint" json:"insertion_point,omitempty"`
|
||||||
|
// The file contents.
|
||||||
|
Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} }
|
||||||
|
func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CodeGeneratorResponse_File) ProtoMessage() {}
|
||||||
|
func (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
|
||||||
|
func (m *CodeGeneratorResponse_File) Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CodeGeneratorResponse_File.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorResponse_File) Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CodeGeneratorResponse_File.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CodeGeneratorResponse_File) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CodeGeneratorResponse_File.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorResponse_File) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CodeGeneratorResponse_File.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CodeGeneratorResponse_File) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CodeGeneratorResponse_File.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CodeGeneratorResponse_File proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CodeGeneratorResponse_File) GetName() string {
|
||||||
|
if m != nil && m.Name != nil {
|
||||||
|
return *m.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorResponse_File) GetInsertionPoint() string {
|
||||||
|
if m != nil && m.InsertionPoint != nil {
|
||||||
|
return *m.InsertionPoint
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CodeGeneratorResponse_File) GetContent() string {
|
||||||
|
if m != nil && m.Content != nil {
|
||||||
|
return *m.Content
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*Version)(nil), "google.protobuf.compiler.Version")
|
||||||
|
proto.RegisterType((*CodeGeneratorRequest)(nil), "google.protobuf.compiler.CodeGeneratorRequest")
|
||||||
|
proto.RegisterType((*CodeGeneratorResponse)(nil), "google.protobuf.compiler.CodeGeneratorResponse")
|
||||||
|
proto.RegisterType((*CodeGeneratorResponse_File)(nil), "google.protobuf.compiler.CodeGeneratorResponse.File")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("google/protobuf/compiler/plugin.proto", fileDescriptor0) }
|
||||||
|
|
||||||
|
var fileDescriptor0 = []byte{
|
||||||
|
// 417 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x6a, 0x14, 0x41,
|
||||||
|
0x10, 0xc6, 0x19, 0x77, 0x63, 0x98, 0x8a, 0x64, 0x43, 0x13, 0xa5, 0x09, 0x39, 0x8c, 0x8b, 0xe2,
|
||||||
|
0x5c, 0x32, 0x0b, 0xc1, 0x8b, 0x78, 0x4b, 0x44, 0x3d, 0x78, 0x58, 0x1a, 0xf1, 0x20, 0xc8, 0x30,
|
||||||
|
0x99, 0xd4, 0x74, 0x5a, 0x66, 0xba, 0xc6, 0xee, 0x1e, 0xf1, 0x49, 0x7d, 0x0f, 0xdf, 0x40, 0xfa,
|
||||||
|
0xcf, 0x24, 0xb2, 0xb8, 0xa7, 0xee, 0xef, 0x57, 0xd5, 0xd5, 0x55, 0x1f, 0x05, 0x2f, 0x25, 0x91,
|
||||||
|
0xec, 0x71, 0x33, 0x1a, 0x72, 0x74, 0x33, 0x75, 0x9b, 0x96, 0x86, 0x51, 0xf5, 0x68, 0x36, 0x63,
|
||||||
|
0x3f, 0x49, 0xa5, 0xab, 0x10, 0x60, 0x3c, 0xa6, 0x55, 0x73, 0x5a, 0x35, 0xa7, 0x9d, 0x15, 0xbb,
|
||||||
|
0x05, 0x6e, 0xd1, 0xb6, 0x46, 0x8d, 0x8e, 0x4c, 0xcc, 0x5e, 0xb7, 0x70, 0xf8, 0x05, 0x8d, 0x55,
|
||||||
|
0xa4, 0xd9, 0x29, 0x1c, 0x0c, 0xcd, 0x77, 0x32, 0x3c, 0x2b, 0xb2, 0xf2, 0x40, 0x44, 0x11, 0xa8,
|
||||||
|
0xd2, 0x64, 0xf8, 0xa3, 0x44, 0xbd, 0xf0, 0x74, 0x6c, 0x5c, 0x7b, 0xc7, 0x17, 0x91, 0x06, 0xc1,
|
||||||
|
0x9e, 0xc1, 0x63, 0x3b, 0x75, 0x9d, 0xfa, 0xc5, 0x97, 0x45, 0x56, 0xe6, 0x22, 0xa9, 0xf5, 0x9f,
|
||||||
|
0x0c, 0x4e, 0xaf, 0xe9, 0x16, 0x3f, 0xa0, 0x46, 0xd3, 0x38, 0x32, 0x02, 0x7f, 0x4c, 0x68, 0x1d,
|
||||||
|
0x2b, 0xe1, 0xa4, 0x53, 0x3d, 0xd6, 0x8e, 0x6a, 0x19, 0x63, 0xc8, 0xb3, 0x62, 0x51, 0xe6, 0xe2,
|
||||||
|
0xd8, 0xf3, 0xcf, 0x94, 0x5e, 0x20, 0x3b, 0x87, 0x7c, 0x6c, 0x4c, 0x33, 0xa0, 0xc3, 0xd8, 0x4a,
|
||||||
|
0x2e, 0x1e, 0x00, 0xbb, 0x06, 0x08, 0xe3, 0xd4, 0xfe, 0x15, 0x5f, 0x15, 0x8b, 0xf2, 0xe8, 0xf2,
|
||||||
|
0x45, 0xb5, 0x6b, 0xcb, 0x7b, 0xd5, 0xe3, 0xbb, 0x7b, 0x03, 0xb6, 0x1e, 0x8b, 0x3c, 0x44, 0x7d,
|
||||||
|
0x84, 0x7d, 0x82, 0x93, 0xd9, 0xb8, 0xfa, 0x67, 0xf4, 0x24, 0x8c, 0x77, 0x74, 0xf9, 0xbc, 0xda,
|
||||||
|
0xe7, 0x70, 0x95, 0xcc, 0x13, 0xab, 0x99, 0x24, 0xb0, 0xfe, 0x9d, 0xc1, 0xd3, 0x9d, 0x99, 0xed,
|
||||||
|
0x48, 0xda, 0xa2, 0xf7, 0x0e, 0x8d, 0x49, 0x3e, 0xe7, 0x22, 0x0a, 0xf6, 0x11, 0x96, 0xff, 0x34,
|
||||||
|
0xff, 0x7a, 0xff, 0x8f, 0xff, 0x2d, 0x1a, 0x66, 0x13, 0xa1, 0xc2, 0xd9, 0x37, 0x58, 0x86, 0x79,
|
||||||
|
0x18, 0x2c, 0x75, 0x33, 0x60, 0xfa, 0x26, 0xdc, 0xd9, 0x2b, 0x58, 0x29, 0x6d, 0xd1, 0x38, 0x45,
|
||||||
|
0xba, 0x1e, 0x49, 0x69, 0x97, 0xcc, 0x3c, 0xbe, 0xc7, 0x5b, 0x4f, 0x19, 0x87, 0xc3, 0x96, 0xb4,
|
||||||
|
0x43, 0xed, 0xf8, 0x2a, 0x24, 0xcc, 0xf2, 0x4a, 0xc2, 0x79, 0x4b, 0xc3, 0xde, 0xfe, 0xae, 0x9e,
|
||||||
|
0x6c, 0xc3, 0x6e, 0x06, 0x7b, 0xed, 0xd7, 0x37, 0x52, 0xb9, 0xbb, 0xe9, 0xc6, 0x87, 0x37, 0x92,
|
||||||
|
0xfa, 0x46, 0xcb, 0x87, 0x65, 0x0c, 0x97, 0xf6, 0x42, 0xa2, 0xbe, 0x90, 0x94, 0x56, 0xfa, 0x6d,
|
||||||
|
0x3c, 0x6a, 0x49, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x15, 0x40, 0xc5, 0xfe, 0x02, 0x00,
|
||||||
|
0x00,
|
||||||
|
}
|
83
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden
generated
vendored
Normal file
83
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
// Code generated by protoc-gen-go.
|
||||||
|
// source: google/protobuf/compiler/plugin.proto
|
||||||
|
// DO NOT EDIT!
|
||||||
|
|
||||||
|
package google_protobuf_compiler
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import "math"
|
||||||
|
import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||||
|
|
||||||
|
// Reference proto and math imports to suppress error if they are not otherwise used.
|
||||||
|
var _ = proto.GetString
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
type CodeGeneratorRequest struct {
|
||||||
|
FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate" json:"file_to_generate,omitempty"`
|
||||||
|
Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"`
|
||||||
|
ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file" json:"proto_file,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorRequest) Reset() { *this = CodeGeneratorRequest{} }
|
||||||
|
func (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*CodeGeneratorRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorRequest) GetParameter() string {
|
||||||
|
if this != nil && this.Parameter != nil {
|
||||||
|
return *this.Parameter
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type CodeGeneratorResponse struct {
|
||||||
|
Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
|
||||||
|
File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorResponse) Reset() { *this = CodeGeneratorResponse{} }
|
||||||
|
func (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*CodeGeneratorResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorResponse) GetError() string {
|
||||||
|
if this != nil && this.Error != nil {
|
||||||
|
return *this.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type CodeGeneratorResponse_File struct {
|
||||||
|
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||||
|
InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point" json:"insertion_point,omitempty"`
|
||||||
|
Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorResponse_File) Reset() { *this = CodeGeneratorResponse_File{} }
|
||||||
|
func (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*CodeGeneratorResponse_File) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorResponse_File) GetName() string {
|
||||||
|
if this != nil && this.Name != nil {
|
||||||
|
return *this.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorResponse_File) GetInsertionPoint() string {
|
||||||
|
if this != nil && this.InsertionPoint != nil {
|
||||||
|
return *this.InsertionPoint
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CodeGeneratorResponse_File) GetContent() string {
|
||||||
|
if this != nil && this.Content != nil {
|
||||||
|
return *this.Content
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
}
|
167
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto
generated
vendored
Normal file
167
vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto
generated
vendored
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
// Author: kenton@google.com (Kenton Varda)
|
||||||
|
//
|
||||||
|
// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
|
||||||
|
// change.
|
||||||
|
//
|
||||||
|
// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
|
||||||
|
// just a program that reads a CodeGeneratorRequest from stdin and writes a
|
||||||
|
// CodeGeneratorResponse to stdout.
|
||||||
|
//
|
||||||
|
// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
|
||||||
|
// of dealing with the raw protocol defined here.
|
||||||
|
//
|
||||||
|
// A plugin executable needs only to be placed somewhere in the path. The
|
||||||
|
// plugin should be named "protoc-gen-$NAME", and will then be used when the
|
||||||
|
// flag "--${NAME}_out" is passed to protoc.
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
package google.protobuf.compiler;
|
||||||
|
option java_package = "com.google.protobuf.compiler";
|
||||||
|
option java_outer_classname = "PluginProtos";
|
||||||
|
|
||||||
|
option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go";
|
||||||
|
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
// The version number of protocol compiler.
|
||||||
|
message Version {
|
||||||
|
optional int32 major = 1;
|
||||||
|
optional int32 minor = 2;
|
||||||
|
optional int32 patch = 3;
|
||||||
|
// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
|
||||||
|
// be empty for mainline stable releases.
|
||||||
|
optional string suffix = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
||||||
|
message CodeGeneratorRequest {
|
||||||
|
// The .proto files that were explicitly listed on the command-line. The
|
||||||
|
// code generator should generate code only for these files. Each file's
|
||||||
|
// descriptor will be included in proto_file, below.
|
||||||
|
repeated string file_to_generate = 1;
|
||||||
|
|
||||||
|
// The generator parameter passed on the command-line.
|
||||||
|
optional string parameter = 2;
|
||||||
|
|
||||||
|
// FileDescriptorProtos for all files in files_to_generate and everything
|
||||||
|
// they import. The files will appear in topological order, so each file
|
||||||
|
// appears before any file that imports it.
|
||||||
|
//
|
||||||
|
// protoc guarantees that all proto_files will be written after
|
||||||
|
// the fields above, even though this is not technically guaranteed by the
|
||||||
|
// protobuf wire format. This theoretically could allow a plugin to stream
|
||||||
|
// in the FileDescriptorProtos and handle them one by one rather than read
|
||||||
|
// the entire set into memory at once. However, as of this writing, this
|
||||||
|
// is not similarly optimized on protoc's end -- it will store all fields in
|
||||||
|
// memory at once before sending them to the plugin.
|
||||||
|
//
|
||||||
|
// Type names of fields and extensions in the FileDescriptorProto are always
|
||||||
|
// fully qualified.
|
||||||
|
repeated FileDescriptorProto proto_file = 15;
|
||||||
|
|
||||||
|
// The version number of protocol compiler.
|
||||||
|
optional Version compiler_version = 3;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// The plugin writes an encoded CodeGeneratorResponse to stdout.
|
||||||
|
message CodeGeneratorResponse {
|
||||||
|
// Error message. If non-empty, code generation failed. The plugin process
|
||||||
|
// should exit with status code zero even if it reports an error in this way.
|
||||||
|
//
|
||||||
|
// This should be used to indicate errors in .proto files which prevent the
|
||||||
|
// code generator from generating correct code. Errors which indicate a
|
||||||
|
// problem in protoc itself -- such as the input CodeGeneratorRequest being
|
||||||
|
// unparseable -- should be reported by writing a message to stderr and
|
||||||
|
// exiting with a non-zero status code.
|
||||||
|
optional string error = 1;
|
||||||
|
|
||||||
|
// Represents a single generated file.
|
||||||
|
message File {
|
||||||
|
// The file name, relative to the output directory. The name must not
|
||||||
|
// contain "." or ".." components and must be relative, not be absolute (so,
|
||||||
|
// the file cannot lie outside the output directory). "/" must be used as
|
||||||
|
// the path separator, not "\".
|
||||||
|
//
|
||||||
|
// If the name is omitted, the content will be appended to the previous
|
||||||
|
// file. This allows the generator to break large files into small chunks,
|
||||||
|
// and allows the generated text to be streamed back to protoc so that large
|
||||||
|
// files need not reside completely in memory at one time. Note that as of
|
||||||
|
// this writing protoc does not optimize for this -- it will read the entire
|
||||||
|
// CodeGeneratorResponse before writing files to disk.
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
// If non-empty, indicates that the named file should already exist, and the
|
||||||
|
// content here is to be inserted into that file at a defined insertion
|
||||||
|
// point. This feature allows a code generator to extend the output
|
||||||
|
// produced by another code generator. The original generator may provide
|
||||||
|
// insertion points by placing special annotations in the file that look
|
||||||
|
// like:
|
||||||
|
// @@protoc_insertion_point(NAME)
|
||||||
|
// The annotation can have arbitrary text before and after it on the line,
|
||||||
|
// which allows it to be placed in a comment. NAME should be replaced with
|
||||||
|
// an identifier naming the point -- this is what other generators will use
|
||||||
|
// as the insertion_point. Code inserted at this point will be placed
|
||||||
|
// immediately above the line containing the insertion point (thus multiple
|
||||||
|
// insertions to the same point will come out in the order they were added).
|
||||||
|
// The double-@ is intended to make it unlikely that the generated code
|
||||||
|
// could contain things that look like insertion points by accident.
|
||||||
|
//
|
||||||
|
// For example, the C++ code generator places the following line in the
|
||||||
|
// .pb.h files that it generates:
|
||||||
|
// // @@protoc_insertion_point(namespace_scope)
|
||||||
|
// This line appears within the scope of the file's package namespace, but
|
||||||
|
// outside of any particular class. Another plugin can then specify the
|
||||||
|
// insertion_point "namespace_scope" to generate additional classes or
|
||||||
|
// other declarations that should be placed in this scope.
|
||||||
|
//
|
||||||
|
// Note that if the line containing the insertion point begins with
|
||||||
|
// whitespace, the same whitespace will be added to every line of the
|
||||||
|
// inserted text. This is useful for languages like Python, where
|
||||||
|
// indentation matters. In these languages, the insertion point comment
|
||||||
|
// should be indented the same amount as any inserted code will need to be
|
||||||
|
// in order to work correctly in that context.
|
||||||
|
//
|
||||||
|
// The code generator that generates the initial file and the one which
|
||||||
|
// inserts into it must both run as part of a single invocation of protoc.
|
||||||
|
// Code generators are executed in the order in which they appear on the
|
||||||
|
// command line.
|
||||||
|
//
|
||||||
|
// If |insertion_point| is present, |name| must also be present.
|
||||||
|
optional string insertion_point = 2;
|
||||||
|
|
||||||
|
// The file contents.
|
||||||
|
optional string content = 15;
|
||||||
|
}
|
||||||
|
repeated File file = 15;
|
||||||
|
}
|
141
vendor/github.com/golang/protobuf/ptypes/any.go
generated
vendored
Normal file
141
vendor/github.com/golang/protobuf/ptypes/any.go
generated
vendored
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
// Go support for Protocol Buffers - Google's data interchange format
|
||||||
|
//
|
||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// https://github.com/golang/protobuf
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package ptypes
|
||||||
|
|
||||||
|
// This file implements functions to marshal proto.Message to/from
|
||||||
|
// google.protobuf.Any message.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/golang/protobuf/ptypes/any"
|
||||||
|
)
|
||||||
|
|
||||||
|
const googleApis = "type.googleapis.com/"
|
||||||
|
|
||||||
|
// AnyMessageName returns the name of the message contained in a google.protobuf.Any message.
|
||||||
|
//
|
||||||
|
// Note that regular type assertions should be done using the Is
|
||||||
|
// function. AnyMessageName is provided for less common use cases like filtering a
|
||||||
|
// sequence of Any messages based on a set of allowed message type names.
|
||||||
|
func AnyMessageName(any *any.Any) (string, error) {
|
||||||
|
if any == nil {
|
||||||
|
return "", fmt.Errorf("message is nil")
|
||||||
|
}
|
||||||
|
slash := strings.LastIndex(any.TypeUrl, "/")
|
||||||
|
if slash < 0 {
|
||||||
|
return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl)
|
||||||
|
}
|
||||||
|
return any.TypeUrl[slash+1:], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any.
|
||||||
|
func MarshalAny(pb proto.Message) (*any.Any, error) {
|
||||||
|
value, err := proto.Marshal(pb)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &any.Any{TypeUrl: googleApis + proto.MessageName(pb), Value: value}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DynamicAny is a value that can be passed to UnmarshalAny to automatically
|
||||||
|
// allocate a proto.Message for the type specified in a google.protobuf.Any
|
||||||
|
// message. The allocated message is stored in the embedded proto.Message.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var x ptypes.DynamicAny
|
||||||
|
// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
|
||||||
|
// fmt.Printf("unmarshaled message: %v", x.Message)
|
||||||
|
type DynamicAny struct {
|
||||||
|
proto.Message
|
||||||
|
}
|
||||||
|
|
||||||
|
// Empty returns a new proto.Message of the type specified in a
|
||||||
|
// google.protobuf.Any message. It returns an error if corresponding message
|
||||||
|
// type isn't linked in.
|
||||||
|
func Empty(any *any.Any) (proto.Message, error) {
|
||||||
|
aname, err := AnyMessageName(any)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
t := proto.MessageType(aname)
|
||||||
|
if t == nil {
|
||||||
|
return nil, fmt.Errorf("any: message type %q isn't linked in", aname)
|
||||||
|
}
|
||||||
|
return reflect.New(t.Elem()).Interface().(proto.Message), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any
|
||||||
|
// message and places the decoded result in pb. It returns an error if type of
|
||||||
|
// contents of Any message does not match type of pb message.
|
||||||
|
//
|
||||||
|
// pb can be a proto.Message, or a *DynamicAny.
|
||||||
|
func UnmarshalAny(any *any.Any, pb proto.Message) error {
|
||||||
|
if d, ok := pb.(*DynamicAny); ok {
|
||||||
|
if d.Message == nil {
|
||||||
|
var err error
|
||||||
|
d.Message, err = Empty(any)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return UnmarshalAny(any, d.Message)
|
||||||
|
}
|
||||||
|
|
||||||
|
aname, err := AnyMessageName(any)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mname := proto.MessageName(pb)
|
||||||
|
if aname != mname {
|
||||||
|
return fmt.Errorf("mismatched message type: got %q want %q", aname, mname)
|
||||||
|
}
|
||||||
|
return proto.Unmarshal(any.Value, pb)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is returns true if any value contains a given message type.
|
||||||
|
func Is(any *any.Any, pb proto.Message) bool {
|
||||||
|
// The following is equivalent to AnyMessageName(any) == proto.MessageName(pb),
|
||||||
|
// but it avoids scanning TypeUrl for the slash.
|
||||||
|
if any == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
name := proto.MessageName(pb)
|
||||||
|
prefix := len(any.TypeUrl) - len(name)
|
||||||
|
return prefix >= 1 && any.TypeUrl[prefix-1] == '/' && any.TypeUrl[prefix:] == name
|
||||||
|
}
|
191
vendor/github.com/golang/protobuf/ptypes/any/any.pb.go
generated
vendored
Normal file
191
vendor/github.com/golang/protobuf/ptypes/any/any.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,191 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google/protobuf/any.proto
|
||||||
|
|
||||||
|
package any // import "github.com/golang/protobuf/ptypes/any"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||||
|
// URL that describes the type of the serialized message.
|
||||||
|
//
|
||||||
|
// Protobuf library provides support to pack/unpack Any values in the form
|
||||||
|
// of utility functions or additional generated methods of the Any type.
|
||||||
|
//
|
||||||
|
// Example 1: Pack and unpack a message in C++.
|
||||||
|
//
|
||||||
|
// Foo foo = ...;
|
||||||
|
// Any any;
|
||||||
|
// any.PackFrom(foo);
|
||||||
|
// ...
|
||||||
|
// if (any.UnpackTo(&foo)) {
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 2: Pack and unpack a message in Java.
|
||||||
|
//
|
||||||
|
// Foo foo = ...;
|
||||||
|
// Any any = Any.pack(foo);
|
||||||
|
// ...
|
||||||
|
// if (any.is(Foo.class)) {
|
||||||
|
// foo = any.unpack(Foo.class);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 3: Pack and unpack a message in Python.
|
||||||
|
//
|
||||||
|
// foo = Foo(...)
|
||||||
|
// any = Any()
|
||||||
|
// any.Pack(foo)
|
||||||
|
// ...
|
||||||
|
// if any.Is(Foo.DESCRIPTOR):
|
||||||
|
// any.Unpack(foo)
|
||||||
|
// ...
|
||||||
|
//
|
||||||
|
// Example 4: Pack and unpack a message in Go
|
||||||
|
//
|
||||||
|
// foo := &pb.Foo{...}
|
||||||
|
// any, err := ptypes.MarshalAny(foo)
|
||||||
|
// ...
|
||||||
|
// foo := &pb.Foo{}
|
||||||
|
// if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// The pack methods provided by protobuf library will by default use
|
||||||
|
// 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
||||||
|
// methods only use the fully qualified type name after the last '/'
|
||||||
|
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
||||||
|
// name "y.z".
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// JSON
|
||||||
|
// ====
|
||||||
|
// The JSON representation of an `Any` value uses the regular
|
||||||
|
// representation of the deserialized, embedded message, with an
|
||||||
|
// additional field `@type` which contains the type URL. Example:
|
||||||
|
//
|
||||||
|
// package google.profile;
|
||||||
|
// message Person {
|
||||||
|
// string first_name = 1;
|
||||||
|
// string last_name = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "@type": "type.googleapis.com/google.profile.Person",
|
||||||
|
// "firstName": <string>,
|
||||||
|
// "lastName": <string>
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// If the embedded message type is well-known and has a custom JSON
|
||||||
|
// representation, that representation will be embedded adding a field
|
||||||
|
// `value` which holds the custom JSON in addition to the `@type`
|
||||||
|
// field. Example (for message [google.protobuf.Duration][]):
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "@type": "type.googleapis.com/google.protobuf.Duration",
|
||||||
|
// "value": "1.212s"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
type Any struct {
|
||||||
|
// A URL/resource name whose content describes the type of the
|
||||||
|
// serialized protocol buffer message.
|
||||||
|
//
|
||||||
|
// For URLs which use the scheme `http`, `https`, or no scheme, the
|
||||||
|
// following restrictions and interpretations apply:
|
||||||
|
//
|
||||||
|
// * If no scheme is provided, `https` is assumed.
|
||||||
|
// * The last segment of the URL's path must represent the fully
|
||||||
|
// qualified name of the type (as in `path/google.protobuf.Duration`).
|
||||||
|
// The name should be in a canonical form (e.g., leading "." is
|
||||||
|
// not accepted).
|
||||||
|
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||||
|
// value in binary format, or produce an error.
|
||||||
|
// * Applications are allowed to cache lookup results based on the
|
||||||
|
// URL, or have them precompiled into a binary to avoid any
|
||||||
|
// lookup. Therefore, binary compatibility needs to be preserved
|
||||||
|
// on changes to types. (Use versioned type names to manage
|
||||||
|
// breaking changes.)
|
||||||
|
//
|
||||||
|
// Schemes other than `http`, `https` (or the empty scheme) might be
|
||||||
|
// used with implementation specific semantics.
|
||||||
|
//
|
||||||
|
TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"`
|
||||||
|
// Must be a valid serialized protocol buffer of the above specified type.
|
||||||
|
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Any) Reset() { *m = Any{} }
|
||||||
|
func (m *Any) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Any) ProtoMessage() {}
|
||||||
|
func (*Any) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_any_744b9ca530f228db, []int{0}
|
||||||
|
}
|
||||||
|
func (*Any) XXX_WellKnownType() string { return "Any" }
|
||||||
|
func (m *Any) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Any.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Any.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Any) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Any.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Any) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Any.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Any) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Any.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Any proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Any) GetTypeUrl() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.TypeUrl
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Any) GetValue() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*Any)(nil), "google.protobuf.Any")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_any_744b9ca530f228db) }
|
||||||
|
|
||||||
|
var fileDescriptor_any_744b9ca530f228db = []byte{
|
||||||
|
// 185 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f,
|
||||||
|
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4,
|
||||||
|
0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x25, 0x33, 0x2e, 0x66, 0xc7, 0xbc, 0x4a,
|
||||||
|
0x21, 0x49, 0x2e, 0x8e, 0x92, 0xca, 0x82, 0xd4, 0xf8, 0xd2, 0xa2, 0x1c, 0x09, 0x46, 0x05, 0x46,
|
||||||
|
0x0d, 0xce, 0x20, 0x76, 0x10, 0x3f, 0xb4, 0x28, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7,
|
||||||
|
0x34, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc2, 0x71, 0xca, 0xe7, 0x12, 0x4e, 0xce,
|
||||||
|
0xcf, 0xd5, 0x43, 0x33, 0xce, 0x89, 0xc3, 0x31, 0xaf, 0x32, 0x00, 0xc4, 0x09, 0x60, 0x8c, 0x52,
|
||||||
|
0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc,
|
||||||
|
0x4b, 0x47, 0xb8, 0xa8, 0x00, 0x64, 0x7a, 0x31, 0xc8, 0x61, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c,
|
||||||
|
0x56, 0x31, 0xc9, 0xb9, 0x43, 0x8c, 0x0a, 0x80, 0x2a, 0xd1, 0x0b, 0x4f, 0xcd, 0xc9, 0xf1, 0xce,
|
||||||
|
0xcb, 0x2f, 0xcf, 0x0b, 0x01, 0x29, 0x4d, 0x62, 0x03, 0xeb, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff,
|
||||||
|
0xff, 0x13, 0xf8, 0xe8, 0x42, 0xdd, 0x00, 0x00, 0x00,
|
||||||
|
}
|
149
vendor/github.com/golang/protobuf/ptypes/any/any.proto
generated
vendored
Normal file
149
vendor/github.com/golang/protobuf/ptypes/any/any.proto
generated
vendored
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option go_package = "github.com/golang/protobuf/ptypes/any";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "AnyProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||||
|
// URL that describes the type of the serialized message.
|
||||||
|
//
|
||||||
|
// Protobuf library provides support to pack/unpack Any values in the form
|
||||||
|
// of utility functions or additional generated methods of the Any type.
|
||||||
|
//
|
||||||
|
// Example 1: Pack and unpack a message in C++.
|
||||||
|
//
|
||||||
|
// Foo foo = ...;
|
||||||
|
// Any any;
|
||||||
|
// any.PackFrom(foo);
|
||||||
|
// ...
|
||||||
|
// if (any.UnpackTo(&foo)) {
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 2: Pack and unpack a message in Java.
|
||||||
|
//
|
||||||
|
// Foo foo = ...;
|
||||||
|
// Any any = Any.pack(foo);
|
||||||
|
// ...
|
||||||
|
// if (any.is(Foo.class)) {
|
||||||
|
// foo = any.unpack(Foo.class);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 3: Pack and unpack a message in Python.
|
||||||
|
//
|
||||||
|
// foo = Foo(...)
|
||||||
|
// any = Any()
|
||||||
|
// any.Pack(foo)
|
||||||
|
// ...
|
||||||
|
// if any.Is(Foo.DESCRIPTOR):
|
||||||
|
// any.Unpack(foo)
|
||||||
|
// ...
|
||||||
|
//
|
||||||
|
// Example 4: Pack and unpack a message in Go
|
||||||
|
//
|
||||||
|
// foo := &pb.Foo{...}
|
||||||
|
// any, err := ptypes.MarshalAny(foo)
|
||||||
|
// ...
|
||||||
|
// foo := &pb.Foo{}
|
||||||
|
// if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// The pack methods provided by protobuf library will by default use
|
||||||
|
// 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
||||||
|
// methods only use the fully qualified type name after the last '/'
|
||||||
|
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
||||||
|
// name "y.z".
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// JSON
|
||||||
|
// ====
|
||||||
|
// The JSON representation of an `Any` value uses the regular
|
||||||
|
// representation of the deserialized, embedded message, with an
|
||||||
|
// additional field `@type` which contains the type URL. Example:
|
||||||
|
//
|
||||||
|
// package google.profile;
|
||||||
|
// message Person {
|
||||||
|
// string first_name = 1;
|
||||||
|
// string last_name = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "@type": "type.googleapis.com/google.profile.Person",
|
||||||
|
// "firstName": <string>,
|
||||||
|
// "lastName": <string>
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// If the embedded message type is well-known and has a custom JSON
|
||||||
|
// representation, that representation will be embedded adding a field
|
||||||
|
// `value` which holds the custom JSON in addition to the `@type`
|
||||||
|
// field. Example (for message [google.protobuf.Duration][]):
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "@type": "type.googleapis.com/google.protobuf.Duration",
|
||||||
|
// "value": "1.212s"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
message Any {
|
||||||
|
// A URL/resource name whose content describes the type of the
|
||||||
|
// serialized protocol buffer message.
|
||||||
|
//
|
||||||
|
// For URLs which use the scheme `http`, `https`, or no scheme, the
|
||||||
|
// following restrictions and interpretations apply:
|
||||||
|
//
|
||||||
|
// * If no scheme is provided, `https` is assumed.
|
||||||
|
// * The last segment of the URL's path must represent the fully
|
||||||
|
// qualified name of the type (as in `path/google.protobuf.Duration`).
|
||||||
|
// The name should be in a canonical form (e.g., leading "." is
|
||||||
|
// not accepted).
|
||||||
|
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||||
|
// value in binary format, or produce an error.
|
||||||
|
// * Applications are allowed to cache lookup results based on the
|
||||||
|
// URL, or have them precompiled into a binary to avoid any
|
||||||
|
// lookup. Therefore, binary compatibility needs to be preserved
|
||||||
|
// on changes to types. (Use versioned type names to manage
|
||||||
|
// breaking changes.)
|
||||||
|
//
|
||||||
|
// Schemes other than `http`, `https` (or the empty scheme) might be
|
||||||
|
// used with implementation specific semantics.
|
||||||
|
//
|
||||||
|
string type_url = 1;
|
||||||
|
|
||||||
|
// Must be a valid serialized protocol buffer of the above specified type.
|
||||||
|
bytes value = 2;
|
||||||
|
}
|
35
vendor/github.com/golang/protobuf/ptypes/doc.go
generated
vendored
Normal file
35
vendor/github.com/golang/protobuf/ptypes/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
// Go support for Protocol Buffers - Google's data interchange format
|
||||||
|
//
|
||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// https://github.com/golang/protobuf
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package ptypes contains code for interacting with well-known types.
|
||||||
|
*/
|
||||||
|
package ptypes
|
102
vendor/github.com/golang/protobuf/ptypes/duration.go
generated
vendored
Normal file
102
vendor/github.com/golang/protobuf/ptypes/duration.go
generated
vendored
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
// Go support for Protocol Buffers - Google's data interchange format
|
||||||
|
//
|
||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// https://github.com/golang/protobuf
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package ptypes
|
||||||
|
|
||||||
|
// This file implements conversions between google.protobuf.Duration
|
||||||
|
// and time.Duration.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
durpb "github.com/golang/protobuf/ptypes/duration"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Range of a durpb.Duration in seconds, as specified in
|
||||||
|
// google/protobuf/duration.proto. This is about 10,000 years in seconds.
|
||||||
|
maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60)
|
||||||
|
minSeconds = -maxSeconds
|
||||||
|
)
|
||||||
|
|
||||||
|
// validateDuration determines whether the durpb.Duration is valid according to the
|
||||||
|
// definition in google/protobuf/duration.proto. A valid durpb.Duration
|
||||||
|
// may still be too large to fit into a time.Duration (the range of durpb.Duration
|
||||||
|
// is about 10,000 years, and the range of time.Duration is about 290).
|
||||||
|
func validateDuration(d *durpb.Duration) error {
|
||||||
|
if d == nil {
|
||||||
|
return errors.New("duration: nil Duration")
|
||||||
|
}
|
||||||
|
if d.Seconds < minSeconds || d.Seconds > maxSeconds {
|
||||||
|
return fmt.Errorf("duration: %v: seconds out of range", d)
|
||||||
|
}
|
||||||
|
if d.Nanos <= -1e9 || d.Nanos >= 1e9 {
|
||||||
|
return fmt.Errorf("duration: %v: nanos out of range", d)
|
||||||
|
}
|
||||||
|
// Seconds and Nanos must have the same sign, unless d.Nanos is zero.
|
||||||
|
if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) {
|
||||||
|
return fmt.Errorf("duration: %v: seconds and nanos have different signs", d)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duration converts a durpb.Duration to a time.Duration. Duration
|
||||||
|
// returns an error if the durpb.Duration is invalid or is too large to be
|
||||||
|
// represented in a time.Duration.
|
||||||
|
func Duration(p *durpb.Duration) (time.Duration, error) {
|
||||||
|
if err := validateDuration(p); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
d := time.Duration(p.Seconds) * time.Second
|
||||||
|
if int64(d/time.Second) != p.Seconds {
|
||||||
|
return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
|
||||||
|
}
|
||||||
|
if p.Nanos != 0 {
|
||||||
|
d += time.Duration(p.Nanos)
|
||||||
|
if (d < 0) != (p.Nanos < 0) {
|
||||||
|
return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DurationProto converts a time.Duration to a durpb.Duration.
|
||||||
|
func DurationProto(d time.Duration) *durpb.Duration {
|
||||||
|
nanos := d.Nanoseconds()
|
||||||
|
secs := nanos / 1e9
|
||||||
|
nanos -= secs * 1e9
|
||||||
|
return &durpb.Duration{
|
||||||
|
Seconds: secs,
|
||||||
|
Nanos: int32(nanos),
|
||||||
|
}
|
||||||
|
}
|
159
vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go
generated
vendored
Normal file
159
vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google/protobuf/duration.proto
|
||||||
|
|
||||||
|
package duration // import "github.com/golang/protobuf/ptypes/duration"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// A Duration represents a signed, fixed-length span of time represented
|
||||||
|
// as a count of seconds and fractions of seconds at nanosecond
|
||||||
|
// resolution. It is independent of any calendar and concepts like "day"
|
||||||
|
// or "month". It is related to Timestamp in that the difference between
|
||||||
|
// two Timestamp values is a Duration and it can be added or subtracted
|
||||||
|
// from a Timestamp. Range is approximately +-10,000 years.
|
||||||
|
//
|
||||||
|
// # Examples
|
||||||
|
//
|
||||||
|
// Example 1: Compute Duration from two Timestamps in pseudo code.
|
||||||
|
//
|
||||||
|
// Timestamp start = ...;
|
||||||
|
// Timestamp end = ...;
|
||||||
|
// Duration duration = ...;
|
||||||
|
//
|
||||||
|
// duration.seconds = end.seconds - start.seconds;
|
||||||
|
// duration.nanos = end.nanos - start.nanos;
|
||||||
|
//
|
||||||
|
// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||||
|
// duration.seconds += 1;
|
||||||
|
// duration.nanos -= 1000000000;
|
||||||
|
// } else if (durations.seconds > 0 && duration.nanos < 0) {
|
||||||
|
// duration.seconds -= 1;
|
||||||
|
// duration.nanos += 1000000000;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
||||||
|
//
|
||||||
|
// Timestamp start = ...;
|
||||||
|
// Duration duration = ...;
|
||||||
|
// Timestamp end = ...;
|
||||||
|
//
|
||||||
|
// end.seconds = start.seconds + duration.seconds;
|
||||||
|
// end.nanos = start.nanos + duration.nanos;
|
||||||
|
//
|
||||||
|
// if (end.nanos < 0) {
|
||||||
|
// end.seconds -= 1;
|
||||||
|
// end.nanos += 1000000000;
|
||||||
|
// } else if (end.nanos >= 1000000000) {
|
||||||
|
// end.seconds += 1;
|
||||||
|
// end.nanos -= 1000000000;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 3: Compute Duration from datetime.timedelta in Python.
|
||||||
|
//
|
||||||
|
// td = datetime.timedelta(days=3, minutes=10)
|
||||||
|
// duration = Duration()
|
||||||
|
// duration.FromTimedelta(td)
|
||||||
|
//
|
||||||
|
// # JSON Mapping
|
||||||
|
//
|
||||||
|
// In JSON format, the Duration type is encoded as a string rather than an
|
||||||
|
// object, where the string ends in the suffix "s" (indicating seconds) and
|
||||||
|
// is preceded by the number of seconds, with nanoseconds expressed as
|
||||||
|
// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
||||||
|
// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
||||||
|
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
||||||
|
// microsecond should be expressed in JSON format as "3.000001s".
|
||||||
|
//
|
||||||
|
//
|
||||||
|
type Duration struct {
|
||||||
|
// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||||
|
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
||||||
|
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
||||||
|
Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
|
||||||
|
// Signed fractions of a second at nanosecond resolution of the span
|
||||||
|
// of time. Durations less than one second are represented with a 0
|
||||||
|
// `seconds` field and a positive or negative `nanos` field. For durations
|
||||||
|
// of one second or more, a non-zero value for the `nanos` field must be
|
||||||
|
// of the same sign as the `seconds` field. Must be from -999,999,999
|
||||||
|
// to +999,999,999 inclusive.
|
||||||
|
Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Duration) Reset() { *m = Duration{} }
|
||||||
|
func (m *Duration) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Duration) ProtoMessage() {}
|
||||||
|
func (*Duration) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_duration_e7d612259e3f0613, []int{0}
|
||||||
|
}
|
||||||
|
func (*Duration) XXX_WellKnownType() string { return "Duration" }
|
||||||
|
func (m *Duration) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Duration.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Duration.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Duration) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Duration.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Duration) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Duration.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Duration) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Duration.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Duration proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Duration) GetSeconds() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Seconds
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Duration) GetNanos() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Nanos
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*Duration)(nil), "google.protobuf.Duration")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_duration_e7d612259e3f0613)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_duration_e7d612259e3f0613 = []byte{
|
||||||
|
// 190 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
|
||||||
|
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a,
|
||||||
|
0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56,
|
||||||
|
0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5,
|
||||||
|
0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e,
|
||||||
|
0x7e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x84, 0xe3, 0x54, 0xc3, 0x25, 0x9c, 0x9c,
|
||||||
|
0x9f, 0xab, 0x87, 0x66, 0xa4, 0x13, 0x2f, 0xcc, 0xc0, 0x00, 0x90, 0x48, 0x00, 0x63, 0x94, 0x56,
|
||||||
|
0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e,
|
||||||
|
0x3a, 0xc2, 0x7d, 0x05, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x70, 0x67, 0xfe, 0x60, 0x64, 0x5c, 0xc4,
|
||||||
|
0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e, 0x00, 0x54, 0xa9, 0x5e, 0x78,
|
||||||
|
0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b, 0x12, 0x1b, 0xd8, 0x0c, 0x63,
|
||||||
|
0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x84, 0x30, 0xff, 0xf3, 0x00, 0x00, 0x00,
|
||||||
|
}
|
117
vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
generated
vendored
Normal file
117
vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "github.com/golang/protobuf/ptypes/duration";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "DurationProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// A Duration represents a signed, fixed-length span of time represented
|
||||||
|
// as a count of seconds and fractions of seconds at nanosecond
|
||||||
|
// resolution. It is independent of any calendar and concepts like "day"
|
||||||
|
// or "month". It is related to Timestamp in that the difference between
|
||||||
|
// two Timestamp values is a Duration and it can be added or subtracted
|
||||||
|
// from a Timestamp. Range is approximately +-10,000 years.
|
||||||
|
//
|
||||||
|
// # Examples
|
||||||
|
//
|
||||||
|
// Example 1: Compute Duration from two Timestamps in pseudo code.
|
||||||
|
//
|
||||||
|
// Timestamp start = ...;
|
||||||
|
// Timestamp end = ...;
|
||||||
|
// Duration duration = ...;
|
||||||
|
//
|
||||||
|
// duration.seconds = end.seconds - start.seconds;
|
||||||
|
// duration.nanos = end.nanos - start.nanos;
|
||||||
|
//
|
||||||
|
// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||||
|
// duration.seconds += 1;
|
||||||
|
// duration.nanos -= 1000000000;
|
||||||
|
// } else if (durations.seconds > 0 && duration.nanos < 0) {
|
||||||
|
// duration.seconds -= 1;
|
||||||
|
// duration.nanos += 1000000000;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
||||||
|
//
|
||||||
|
// Timestamp start = ...;
|
||||||
|
// Duration duration = ...;
|
||||||
|
// Timestamp end = ...;
|
||||||
|
//
|
||||||
|
// end.seconds = start.seconds + duration.seconds;
|
||||||
|
// end.nanos = start.nanos + duration.nanos;
|
||||||
|
//
|
||||||
|
// if (end.nanos < 0) {
|
||||||
|
// end.seconds -= 1;
|
||||||
|
// end.nanos += 1000000000;
|
||||||
|
// } else if (end.nanos >= 1000000000) {
|
||||||
|
// end.seconds += 1;
|
||||||
|
// end.nanos -= 1000000000;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 3: Compute Duration from datetime.timedelta in Python.
|
||||||
|
//
|
||||||
|
// td = datetime.timedelta(days=3, minutes=10)
|
||||||
|
// duration = Duration()
|
||||||
|
// duration.FromTimedelta(td)
|
||||||
|
//
|
||||||
|
// # JSON Mapping
|
||||||
|
//
|
||||||
|
// In JSON format, the Duration type is encoded as a string rather than an
|
||||||
|
// object, where the string ends in the suffix "s" (indicating seconds) and
|
||||||
|
// is preceded by the number of seconds, with nanoseconds expressed as
|
||||||
|
// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
||||||
|
// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
||||||
|
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
||||||
|
// microsecond should be expressed in JSON format as "3.000001s".
|
||||||
|
//
|
||||||
|
//
|
||||||
|
message Duration {
|
||||||
|
|
||||||
|
// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||||
|
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
||||||
|
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
||||||
|
int64 seconds = 1;
|
||||||
|
|
||||||
|
// Signed fractions of a second at nanosecond resolution of the span
|
||||||
|
// of time. Durations less than one second are represented with a 0
|
||||||
|
// `seconds` field and a positive or negative `nanos` field. For durations
|
||||||
|
// of one second or more, a non-zero value for the `nanos` field must be
|
||||||
|
// of the same sign as the `seconds` field. Must be from -999,999,999
|
||||||
|
// to +999,999,999 inclusive.
|
||||||
|
int32 nanos = 2;
|
||||||
|
}
|
450
vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go
generated
vendored
Normal file
450
vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,450 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google/protobuf/struct.proto
|
||||||
|
|
||||||
|
package structpb // import "github.com/golang/protobuf/ptypes/struct"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// `NullValue` is a singleton enumeration to represent the null value for the
|
||||||
|
// `Value` type union.
|
||||||
|
//
|
||||||
|
// The JSON representation for `NullValue` is JSON `null`.
|
||||||
|
type NullValue int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Null value.
|
||||||
|
NullValue_NULL_VALUE NullValue = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
var NullValue_name = map[int32]string{
|
||||||
|
0: "NULL_VALUE",
|
||||||
|
}
|
||||||
|
var NullValue_value = map[string]int32{
|
||||||
|
"NULL_VALUE": 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x NullValue) String() string {
|
||||||
|
return proto.EnumName(NullValue_name, int32(x))
|
||||||
|
}
|
||||||
|
func (NullValue) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_struct_3a5a94e0c7801b27, []int{0}
|
||||||
|
}
|
||||||
|
func (NullValue) XXX_WellKnownType() string { return "NullValue" }
|
||||||
|
|
||||||
|
// `Struct` represents a structured data value, consisting of fields
|
||||||
|
// which map to dynamically typed values. In some languages, `Struct`
|
||||||
|
// might be supported by a native representation. For example, in
|
||||||
|
// scripting languages like JS a struct is represented as an
|
||||||
|
// object. The details of that representation are described together
|
||||||
|
// with the proto support for the language.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Struct` is JSON object.
|
||||||
|
type Struct struct {
|
||||||
|
// Unordered map of dynamically typed values.
|
||||||
|
Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Struct) Reset() { *m = Struct{} }
|
||||||
|
func (m *Struct) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Struct) ProtoMessage() {}
|
||||||
|
func (*Struct) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_struct_3a5a94e0c7801b27, []int{0}
|
||||||
|
}
|
||||||
|
func (*Struct) XXX_WellKnownType() string { return "Struct" }
|
||||||
|
func (m *Struct) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Struct.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Struct.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Struct) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Struct.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Struct) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Struct.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Struct) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Struct.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Struct proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Struct) GetFields() map[string]*Value {
|
||||||
|
if m != nil {
|
||||||
|
return m.Fields
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// `Value` represents a dynamically typed value which can be either
|
||||||
|
// null, a number, a string, a boolean, a recursive struct value, or a
|
||||||
|
// list of values. A producer of value is expected to set one of that
|
||||||
|
// variants, absence of any variant indicates an error.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Value` is JSON value.
|
||||||
|
type Value struct {
|
||||||
|
// The kind of value.
|
||||||
|
//
|
||||||
|
// Types that are valid to be assigned to Kind:
|
||||||
|
// *Value_NullValue
|
||||||
|
// *Value_NumberValue
|
||||||
|
// *Value_StringValue
|
||||||
|
// *Value_BoolValue
|
||||||
|
// *Value_StructValue
|
||||||
|
// *Value_ListValue
|
||||||
|
Kind isValue_Kind `protobuf_oneof:"kind"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Value) Reset() { *m = Value{} }
|
||||||
|
func (m *Value) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Value) ProtoMessage() {}
|
||||||
|
func (*Value) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_struct_3a5a94e0c7801b27, []int{1}
|
||||||
|
}
|
||||||
|
func (*Value) XXX_WellKnownType() string { return "Value" }
|
||||||
|
func (m *Value) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Value.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Value.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Value) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Value.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Value) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Value.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Value) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Value.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Value proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type isValue_Kind interface {
|
||||||
|
isValue_Kind()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Value_NullValue struct {
|
||||||
|
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Value_NumberValue struct {
|
||||||
|
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Value_StringValue struct {
|
||||||
|
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Value_BoolValue struct {
|
||||||
|
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Value_StructValue struct {
|
||||||
|
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Value_ListValue struct {
|
||||||
|
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Value_NullValue) isValue_Kind() {}
|
||||||
|
|
||||||
|
func (*Value_NumberValue) isValue_Kind() {}
|
||||||
|
|
||||||
|
func (*Value_StringValue) isValue_Kind() {}
|
||||||
|
|
||||||
|
func (*Value_BoolValue) isValue_Kind() {}
|
||||||
|
|
||||||
|
func (*Value_StructValue) isValue_Kind() {}
|
||||||
|
|
||||||
|
func (*Value_ListValue) isValue_Kind() {}
|
||||||
|
|
||||||
|
func (m *Value) GetKind() isValue_Kind {
|
||||||
|
if m != nil {
|
||||||
|
return m.Kind
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Value) GetNullValue() NullValue {
|
||||||
|
if x, ok := m.GetKind().(*Value_NullValue); ok {
|
||||||
|
return x.NullValue
|
||||||
|
}
|
||||||
|
return NullValue_NULL_VALUE
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Value) GetNumberValue() float64 {
|
||||||
|
if x, ok := m.GetKind().(*Value_NumberValue); ok {
|
||||||
|
return x.NumberValue
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Value) GetStringValue() string {
|
||||||
|
if x, ok := m.GetKind().(*Value_StringValue); ok {
|
||||||
|
return x.StringValue
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Value) GetBoolValue() bool {
|
||||||
|
if x, ok := m.GetKind().(*Value_BoolValue); ok {
|
||||||
|
return x.BoolValue
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Value) GetStructValue() *Struct {
|
||||||
|
if x, ok := m.GetKind().(*Value_StructValue); ok {
|
||||||
|
return x.StructValue
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Value) GetListValue() *ListValue {
|
||||||
|
if x, ok := m.GetKind().(*Value_ListValue); ok {
|
||||||
|
return x.ListValue
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||||
|
func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||||
|
return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{
|
||||||
|
(*Value_NullValue)(nil),
|
||||||
|
(*Value_NumberValue)(nil),
|
||||||
|
(*Value_StringValue)(nil),
|
||||||
|
(*Value_BoolValue)(nil),
|
||||||
|
(*Value_StructValue)(nil),
|
||||||
|
(*Value_ListValue)(nil),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||||
|
m := msg.(*Value)
|
||||||
|
// kind
|
||||||
|
switch x := m.Kind.(type) {
|
||||||
|
case *Value_NullValue:
|
||||||
|
b.EncodeVarint(1<<3 | proto.WireVarint)
|
||||||
|
b.EncodeVarint(uint64(x.NullValue))
|
||||||
|
case *Value_NumberValue:
|
||||||
|
b.EncodeVarint(2<<3 | proto.WireFixed64)
|
||||||
|
b.EncodeFixed64(math.Float64bits(x.NumberValue))
|
||||||
|
case *Value_StringValue:
|
||||||
|
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||||
|
b.EncodeStringBytes(x.StringValue)
|
||||||
|
case *Value_BoolValue:
|
||||||
|
t := uint64(0)
|
||||||
|
if x.BoolValue {
|
||||||
|
t = 1
|
||||||
|
}
|
||||||
|
b.EncodeVarint(4<<3 | proto.WireVarint)
|
||||||
|
b.EncodeVarint(t)
|
||||||
|
case *Value_StructValue:
|
||||||
|
b.EncodeVarint(5<<3 | proto.WireBytes)
|
||||||
|
if err := b.EncodeMessage(x.StructValue); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case *Value_ListValue:
|
||||||
|
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||||
|
if err := b.EncodeMessage(x.ListValue); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case nil:
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("Value.Kind has unexpected type %T", x)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||||
|
m := msg.(*Value)
|
||||||
|
switch tag {
|
||||||
|
case 1: // kind.null_value
|
||||||
|
if wire != proto.WireVarint {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
x, err := b.DecodeVarint()
|
||||||
|
m.Kind = &Value_NullValue{NullValue(x)}
|
||||||
|
return true, err
|
||||||
|
case 2: // kind.number_value
|
||||||
|
if wire != proto.WireFixed64 {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
x, err := b.DecodeFixed64()
|
||||||
|
m.Kind = &Value_NumberValue{math.Float64frombits(x)}
|
||||||
|
return true, err
|
||||||
|
case 3: // kind.string_value
|
||||||
|
if wire != proto.WireBytes {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
x, err := b.DecodeStringBytes()
|
||||||
|
m.Kind = &Value_StringValue{x}
|
||||||
|
return true, err
|
||||||
|
case 4: // kind.bool_value
|
||||||
|
if wire != proto.WireVarint {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
x, err := b.DecodeVarint()
|
||||||
|
m.Kind = &Value_BoolValue{x != 0}
|
||||||
|
return true, err
|
||||||
|
case 5: // kind.struct_value
|
||||||
|
if wire != proto.WireBytes {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
msg := new(Struct)
|
||||||
|
err := b.DecodeMessage(msg)
|
||||||
|
m.Kind = &Value_StructValue{msg}
|
||||||
|
return true, err
|
||||||
|
case 6: // kind.list_value
|
||||||
|
if wire != proto.WireBytes {
|
||||||
|
return true, proto.ErrInternalBadWireType
|
||||||
|
}
|
||||||
|
msg := new(ListValue)
|
||||||
|
err := b.DecodeMessage(msg)
|
||||||
|
m.Kind = &Value_ListValue{msg}
|
||||||
|
return true, err
|
||||||
|
default:
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Value_OneofSizer(msg proto.Message) (n int) {
|
||||||
|
m := msg.(*Value)
|
||||||
|
// kind
|
||||||
|
switch x := m.Kind.(type) {
|
||||||
|
case *Value_NullValue:
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += proto.SizeVarint(uint64(x.NullValue))
|
||||||
|
case *Value_NumberValue:
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += 8
|
||||||
|
case *Value_StringValue:
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += proto.SizeVarint(uint64(len(x.StringValue)))
|
||||||
|
n += len(x.StringValue)
|
||||||
|
case *Value_BoolValue:
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += 1
|
||||||
|
case *Value_StructValue:
|
||||||
|
s := proto.Size(x.StructValue)
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += proto.SizeVarint(uint64(s))
|
||||||
|
n += s
|
||||||
|
case *Value_ListValue:
|
||||||
|
s := proto.Size(x.ListValue)
|
||||||
|
n += 1 // tag and wire
|
||||||
|
n += proto.SizeVarint(uint64(s))
|
||||||
|
n += s
|
||||||
|
case nil:
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
// `ListValue` is a wrapper around a repeated field of values.
|
||||||
|
//
|
||||||
|
// The JSON representation for `ListValue` is JSON array.
|
||||||
|
type ListValue struct {
|
||||||
|
// Repeated field of dynamically typed values.
|
||||||
|
Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ListValue) Reset() { *m = ListValue{} }
|
||||||
|
func (m *ListValue) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ListValue) ProtoMessage() {}
|
||||||
|
func (*ListValue) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_struct_3a5a94e0c7801b27, []int{2}
|
||||||
|
}
|
||||||
|
func (*ListValue) XXX_WellKnownType() string { return "ListValue" }
|
||||||
|
func (m *ListValue) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ListValue.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ListValue.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ListValue) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ListValue.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ListValue) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ListValue.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ListValue) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ListValue.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ListValue proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ListValue) GetValues() []*Value {
|
||||||
|
if m != nil {
|
||||||
|
return m.Values
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*Struct)(nil), "google.protobuf.Struct")
|
||||||
|
proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry")
|
||||||
|
proto.RegisterType((*Value)(nil), "google.protobuf.Value")
|
||||||
|
proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue")
|
||||||
|
proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor_struct_3a5a94e0c7801b27)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_struct_3a5a94e0c7801b27 = []byte{
|
||||||
|
// 417 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40,
|
||||||
|
0x14, 0xc7, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa2, 0xa1, 0x7b, 0x09,
|
||||||
|
0x22, 0x29, 0xd6, 0x8b, 0x18, 0x2f, 0x06, 0xd6, 0x5d, 0x30, 0x2c, 0x31, 0xba, 0x15, 0xbc, 0x94,
|
||||||
|
0x26, 0x4d, 0x63, 0xe8, 0x74, 0x26, 0x24, 0x33, 0x4a, 0x8f, 0x7e, 0x0b, 0xcf, 0x1e, 0x3d, 0xfa,
|
||||||
|
0xe9, 0x3c, 0xca, 0xcc, 0x24, 0xa9, 0xb4, 0xf4, 0x94, 0xbc, 0xf7, 0x7e, 0xef, 0x3f, 0xef, 0xff,
|
||||||
|
0x66, 0xe0, 0x71, 0xc1, 0x58, 0x41, 0xf2, 0x49, 0x55, 0x33, 0xce, 0x52, 0xb1, 0x9a, 0x34, 0xbc,
|
||||||
|
0x16, 0x19, 0xf7, 0x55, 0x8c, 0xef, 0xe9, 0xaa, 0xdf, 0x55, 0xc7, 0x3f, 0x11, 0x58, 0x1f, 0x15,
|
||||||
|
0x81, 0x03, 0xb0, 0x56, 0x65, 0x4e, 0x96, 0xcd, 0x08, 0xb9, 0xa6, 0xe7, 0x4c, 0x2f, 0xfc, 0x3d,
|
||||||
|
0xd8, 0xd7, 0xa0, 0xff, 0x4e, 0x51, 0x97, 0x94, 0xd7, 0xdb, 0xa4, 0x6d, 0x39, 0xff, 0x00, 0xce,
|
||||||
|
0x7f, 0x69, 0x7c, 0x06, 0xe6, 0x3a, 0xdf, 0x8e, 0x90, 0x8b, 0x3c, 0x3b, 0x91, 0xbf, 0xf8, 0x39,
|
||||||
|
0x0c, 0xbf, 0x2d, 0x88, 0xc8, 0x47, 0x86, 0x8b, 0x3c, 0x67, 0xfa, 0xe0, 0x40, 0x7c, 0x26, 0xab,
|
||||||
|
0x89, 0x86, 0x5e, 0x1b, 0xaf, 0xd0, 0xf8, 0x8f, 0x01, 0x43, 0x95, 0xc4, 0x01, 0x00, 0x15, 0x84,
|
||||||
|
0xcc, 0xb5, 0x80, 0x14, 0x3d, 0x9d, 0x9e, 0x1f, 0x08, 0xdc, 0x08, 0x42, 0x14, 0x7f, 0x3d, 0x48,
|
||||||
|
0x6c, 0xda, 0x05, 0xf8, 0x02, 0xee, 0x52, 0xb1, 0x49, 0xf3, 0x7a, 0xbe, 0x3b, 0x1f, 0x5d, 0x0f,
|
||||||
|
0x12, 0x47, 0x67, 0x7b, 0xa8, 0xe1, 0x75, 0x49, 0x8b, 0x16, 0x32, 0xe5, 0xe0, 0x12, 0xd2, 0x59,
|
||||||
|
0x0d, 0x3d, 0x05, 0x48, 0x19, 0xeb, 0xc6, 0x38, 0x71, 0x91, 0x77, 0x47, 0x1e, 0x25, 0x73, 0x1a,
|
||||||
|
0x78, 0xa3, 0x54, 0x44, 0xc6, 0x5b, 0x64, 0xa8, 0xac, 0x3e, 0x3c, 0xb2, 0xc7, 0x56, 0x5e, 0x64,
|
||||||
|
0xbc, 0x77, 0x49, 0xca, 0xa6, 0xeb, 0xb5, 0x54, 0xef, 0xa1, 0xcb, 0xa8, 0x6c, 0x78, 0xef, 0x92,
|
||||||
|
0x74, 0x41, 0x68, 0xc1, 0xc9, 0xba, 0xa4, 0xcb, 0x71, 0x00, 0x76, 0x4f, 0x60, 0x1f, 0x2c, 0x25,
|
||||||
|
0xd6, 0xdd, 0xe8, 0xb1, 0xa5, 0xb7, 0xd4, 0xb3, 0x47, 0x60, 0xf7, 0x4b, 0xc4, 0xa7, 0x00, 0x37,
|
||||||
|
0xb7, 0x51, 0x34, 0x9f, 0xbd, 0x8d, 0x6e, 0x2f, 0xcf, 0x06, 0xe1, 0x0f, 0x04, 0xf7, 0x33, 0xb6,
|
||||||
|
0xd9, 0x97, 0x08, 0x1d, 0xed, 0x26, 0x96, 0x71, 0x8c, 0xbe, 0xbc, 0x28, 0x4a, 0xfe, 0x55, 0xa4,
|
||||||
|
0x7e, 0xc6, 0x36, 0x93, 0x82, 0x91, 0x05, 0x2d, 0x76, 0x4f, 0xb1, 0xe2, 0xdb, 0x2a, 0x6f, 0xda,
|
||||||
|
0x17, 0x19, 0xe8, 0x4f, 0x95, 0xfe, 0x45, 0xe8, 0x97, 0x61, 0x5e, 0xc5, 0xe1, 0x6f, 0xe3, 0xc9,
|
||||||
|
0x95, 0x16, 0x8f, 0xbb, 0xf9, 0x3e, 0xe7, 0x84, 0xbc, 0xa7, 0xec, 0x3b, 0xfd, 0x24, 0x3b, 0x53,
|
||||||
|
0x4b, 0x49, 0xbd, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x1b, 0x59, 0xf8, 0xe5, 0x02, 0x00,
|
||||||
|
0x00,
|
||||||
|
}
|
96
vendor/github.com/golang/protobuf/ptypes/struct/struct.proto
generated
vendored
Normal file
96
vendor/github.com/golang/protobuf/ptypes/struct/struct.proto
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "StructProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
|
||||||
|
// `Struct` represents a structured data value, consisting of fields
|
||||||
|
// which map to dynamically typed values. In some languages, `Struct`
|
||||||
|
// might be supported by a native representation. For example, in
|
||||||
|
// scripting languages like JS a struct is represented as an
|
||||||
|
// object. The details of that representation are described together
|
||||||
|
// with the proto support for the language.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Struct` is JSON object.
|
||||||
|
message Struct {
|
||||||
|
// Unordered map of dynamically typed values.
|
||||||
|
map<string, Value> fields = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `Value` represents a dynamically typed value which can be either
|
||||||
|
// null, a number, a string, a boolean, a recursive struct value, or a
|
||||||
|
// list of values. A producer of value is expected to set one of that
|
||||||
|
// variants, absence of any variant indicates an error.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Value` is JSON value.
|
||||||
|
message Value {
|
||||||
|
// The kind of value.
|
||||||
|
oneof kind {
|
||||||
|
// Represents a null value.
|
||||||
|
NullValue null_value = 1;
|
||||||
|
// Represents a double value.
|
||||||
|
double number_value = 2;
|
||||||
|
// Represents a string value.
|
||||||
|
string string_value = 3;
|
||||||
|
// Represents a boolean value.
|
||||||
|
bool bool_value = 4;
|
||||||
|
// Represents a structured value.
|
||||||
|
Struct struct_value = 5;
|
||||||
|
// Represents a repeated `Value`.
|
||||||
|
ListValue list_value = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// `NullValue` is a singleton enumeration to represent the null value for the
|
||||||
|
// `Value` type union.
|
||||||
|
//
|
||||||
|
// The JSON representation for `NullValue` is JSON `null`.
|
||||||
|
enum NullValue {
|
||||||
|
// Null value.
|
||||||
|
NULL_VALUE = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `ListValue` is a wrapper around a repeated field of values.
|
||||||
|
//
|
||||||
|
// The JSON representation for `ListValue` is JSON array.
|
||||||
|
message ListValue {
|
||||||
|
// Repeated field of dynamically typed values.
|
||||||
|
repeated Value values = 1;
|
||||||
|
}
|
134
vendor/github.com/golang/protobuf/ptypes/timestamp.go
generated
vendored
Normal file
134
vendor/github.com/golang/protobuf/ptypes/timestamp.go
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
// Go support for Protocol Buffers - Google's data interchange format
|
||||||
|
//
|
||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// https://github.com/golang/protobuf
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package ptypes
|
||||||
|
|
||||||
|
// This file implements operations on google.protobuf.Timestamp.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
tspb "github.com/golang/protobuf/ptypes/timestamp"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Seconds field of the earliest valid Timestamp.
|
||||||
|
// This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix().
|
||||||
|
minValidSeconds = -62135596800
|
||||||
|
// Seconds field just after the latest valid Timestamp.
|
||||||
|
// This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix().
|
||||||
|
maxValidSeconds = 253402300800
|
||||||
|
)
|
||||||
|
|
||||||
|
// validateTimestamp determines whether a Timestamp is valid.
|
||||||
|
// A valid timestamp represents a time in the range
|
||||||
|
// [0001-01-01, 10000-01-01) and has a Nanos field
|
||||||
|
// in the range [0, 1e9).
|
||||||
|
//
|
||||||
|
// If the Timestamp is valid, validateTimestamp returns nil.
|
||||||
|
// Otherwise, it returns an error that describes
|
||||||
|
// the problem.
|
||||||
|
//
|
||||||
|
// Every valid Timestamp can be represented by a time.Time, but the converse is not true.
|
||||||
|
func validateTimestamp(ts *tspb.Timestamp) error {
|
||||||
|
if ts == nil {
|
||||||
|
return errors.New("timestamp: nil Timestamp")
|
||||||
|
}
|
||||||
|
if ts.Seconds < minValidSeconds {
|
||||||
|
return fmt.Errorf("timestamp: %v before 0001-01-01", ts)
|
||||||
|
}
|
||||||
|
if ts.Seconds >= maxValidSeconds {
|
||||||
|
return fmt.Errorf("timestamp: %v after 10000-01-01", ts)
|
||||||
|
}
|
||||||
|
if ts.Nanos < 0 || ts.Nanos >= 1e9 {
|
||||||
|
return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timestamp converts a google.protobuf.Timestamp proto to a time.Time.
|
||||||
|
// It returns an error if the argument is invalid.
|
||||||
|
//
|
||||||
|
// Unlike most Go functions, if Timestamp returns an error, the first return value
|
||||||
|
// is not the zero time.Time. Instead, it is the value obtained from the
|
||||||
|
// time.Unix function when passed the contents of the Timestamp, in the UTC
|
||||||
|
// locale. This may or may not be a meaningful time; many invalid Timestamps
|
||||||
|
// do map to valid time.Times.
|
||||||
|
//
|
||||||
|
// A nil Timestamp returns an error. The first return value in that case is
|
||||||
|
// undefined.
|
||||||
|
func Timestamp(ts *tspb.Timestamp) (time.Time, error) {
|
||||||
|
// Don't return the zero value on error, because corresponds to a valid
|
||||||
|
// timestamp. Instead return whatever time.Unix gives us.
|
||||||
|
var t time.Time
|
||||||
|
if ts == nil {
|
||||||
|
t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp
|
||||||
|
} else {
|
||||||
|
t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC()
|
||||||
|
}
|
||||||
|
return t, validateTimestamp(ts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimestampNow returns a google.protobuf.Timestamp for the current time.
|
||||||
|
func TimestampNow() *tspb.Timestamp {
|
||||||
|
ts, err := TimestampProto(time.Now())
|
||||||
|
if err != nil {
|
||||||
|
panic("ptypes: time.Now() out of Timestamp range")
|
||||||
|
}
|
||||||
|
return ts
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
|
||||||
|
// It returns an error if the resulting Timestamp is invalid.
|
||||||
|
func TimestampProto(t time.Time) (*tspb.Timestamp, error) {
|
||||||
|
seconds := t.Unix()
|
||||||
|
nanos := int32(t.Sub(time.Unix(seconds, 0)))
|
||||||
|
ts := &tspb.Timestamp{
|
||||||
|
Seconds: seconds,
|
||||||
|
Nanos: nanos,
|
||||||
|
}
|
||||||
|
if err := validateTimestamp(ts); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ts, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimestampString returns the RFC 3339 string for valid Timestamps. For invalid
|
||||||
|
// Timestamps, it returns an error message in parentheses.
|
||||||
|
func TimestampString(ts *tspb.Timestamp) string {
|
||||||
|
t, err := Timestamp(ts)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Sprintf("(%v)", err)
|
||||||
|
}
|
||||||
|
return t.Format(time.RFC3339Nano)
|
||||||
|
}
|
175
vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go
generated
vendored
Normal file
175
vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google/protobuf/timestamp.proto
|
||||||
|
|
||||||
|
package timestamp // import "github.com/golang/protobuf/ptypes/timestamp"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// A Timestamp represents a point in time independent of any time zone
|
||||||
|
// or calendar, represented as seconds and fractions of seconds at
|
||||||
|
// nanosecond resolution in UTC Epoch time. It is encoded using the
|
||||||
|
// Proleptic Gregorian Calendar which extends the Gregorian calendar
|
||||||
|
// backwards to year one. It is encoded assuming all minutes are 60
|
||||||
|
// seconds long, i.e. leap seconds are "smeared" so that no leap second
|
||||||
|
// table is needed for interpretation. Range is from
|
||||||
|
// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
||||||
|
// By restricting to that range, we ensure that we can convert to
|
||||||
|
// and from RFC 3339 date strings.
|
||||||
|
// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
||||||
|
//
|
||||||
|
// # Examples
|
||||||
|
//
|
||||||
|
// Example 1: Compute Timestamp from POSIX `time()`.
|
||||||
|
//
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds(time(NULL));
|
||||||
|
// timestamp.set_nanos(0);
|
||||||
|
//
|
||||||
|
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||||
|
//
|
||||||
|
// struct timeval tv;
|
||||||
|
// gettimeofday(&tv, NULL);
|
||||||
|
//
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds(tv.tv_sec);
|
||||||
|
// timestamp.set_nanos(tv.tv_usec * 1000);
|
||||||
|
//
|
||||||
|
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||||
|
//
|
||||||
|
// FILETIME ft;
|
||||||
|
// GetSystemTimeAsFileTime(&ft);
|
||||||
|
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||||
|
//
|
||||||
|
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||||
|
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||||
|
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||||
|
//
|
||||||
|
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||||
|
//
|
||||||
|
// long millis = System.currentTimeMillis();
|
||||||
|
//
|
||||||
|
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||||
|
// .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Example 5: Compute Timestamp from current time in Python.
|
||||||
|
//
|
||||||
|
// timestamp = Timestamp()
|
||||||
|
// timestamp.GetCurrentTime()
|
||||||
|
//
|
||||||
|
// # JSON Mapping
|
||||||
|
//
|
||||||
|
// In JSON format, the Timestamp type is encoded as a string in the
|
||||||
|
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||||
|
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||||
|
// where {year} is always expressed using four digits while {month}, {day},
|
||||||
|
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||||
|
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||||
|
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||||
|
// is required, though only UTC (as indicated by "Z") is presently supported.
|
||||||
|
//
|
||||||
|
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||||
|
// 01:30 UTC on January 15, 2017.
|
||||||
|
//
|
||||||
|
// In JavaScript, one can convert a Date object to this format using the
|
||||||
|
// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
|
||||||
|
// method. In Python, a standard `datetime.datetime` object can be converted
|
||||||
|
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
||||||
|
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
||||||
|
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||||
|
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--)
|
||||||
|
// to obtain a formatter capable of generating timestamps in this format.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
type Timestamp struct {
|
||||||
|
// Represents seconds of UTC time since Unix epoch
|
||||||
|
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||||
|
// 9999-12-31T23:59:59Z inclusive.
|
||||||
|
Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
|
||||||
|
// Non-negative fractions of a second at nanosecond resolution. Negative
|
||||||
|
// second values with fractions must still have non-negative nanos values
|
||||||
|
// that count forward in time. Must be from 0 to 999,999,999
|
||||||
|
// inclusive.
|
||||||
|
Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Timestamp) Reset() { *m = Timestamp{} }
|
||||||
|
func (m *Timestamp) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Timestamp) ProtoMessage() {}
|
||||||
|
func (*Timestamp) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_timestamp_b826e8e5fba671a8, []int{0}
|
||||||
|
}
|
||||||
|
func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" }
|
||||||
|
func (m *Timestamp) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Timestamp.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Timestamp) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Timestamp.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Timestamp) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Timestamp.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Timestamp) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Timestamp.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Timestamp proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Timestamp) GetSeconds() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Seconds
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Timestamp) GetNanos() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Nanos
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_timestamp_b826e8e5fba671a8)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_timestamp_b826e8e5fba671a8 = []byte{
|
||||||
|
// 191 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f,
|
||||||
|
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d,
|
||||||
|
0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28,
|
||||||
|
0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5,
|
||||||
|
0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89,
|
||||||
|
0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x1d, 0x97, 0x70,
|
||||||
|
0x72, 0x7e, 0xae, 0x1e, 0x9a, 0x99, 0x4e, 0x7c, 0x70, 0x13, 0x03, 0x40, 0x42, 0x01, 0x8c, 0x51,
|
||||||
|
0xda, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89,
|
||||||
|
0x79, 0xe9, 0x08, 0x27, 0x16, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x23, 0x5c, 0xfa, 0x83, 0x91, 0x71,
|
||||||
|
0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xc9, 0x01, 0x50, 0xb5, 0x7a,
|
||||||
|
0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x3d, 0x49, 0x6c, 0x60, 0x43,
|
||||||
|
0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x77, 0x4a, 0x07, 0xf7, 0x00, 0x00, 0x00,
|
||||||
|
}
|
133
vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto
generated
vendored
Normal file
133
vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto
generated
vendored
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "github.com/golang/protobuf/ptypes/timestamp";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "TimestampProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// A Timestamp represents a point in time independent of any time zone
|
||||||
|
// or calendar, represented as seconds and fractions of seconds at
|
||||||
|
// nanosecond resolution in UTC Epoch time. It is encoded using the
|
||||||
|
// Proleptic Gregorian Calendar which extends the Gregorian calendar
|
||||||
|
// backwards to year one. It is encoded assuming all minutes are 60
|
||||||
|
// seconds long, i.e. leap seconds are "smeared" so that no leap second
|
||||||
|
// table is needed for interpretation. Range is from
|
||||||
|
// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
||||||
|
// By restricting to that range, we ensure that we can convert to
|
||||||
|
// and from RFC 3339 date strings.
|
||||||
|
// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
||||||
|
//
|
||||||
|
// # Examples
|
||||||
|
//
|
||||||
|
// Example 1: Compute Timestamp from POSIX `time()`.
|
||||||
|
//
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds(time(NULL));
|
||||||
|
// timestamp.set_nanos(0);
|
||||||
|
//
|
||||||
|
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||||
|
//
|
||||||
|
// struct timeval tv;
|
||||||
|
// gettimeofday(&tv, NULL);
|
||||||
|
//
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds(tv.tv_sec);
|
||||||
|
// timestamp.set_nanos(tv.tv_usec * 1000);
|
||||||
|
//
|
||||||
|
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||||
|
//
|
||||||
|
// FILETIME ft;
|
||||||
|
// GetSystemTimeAsFileTime(&ft);
|
||||||
|
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||||
|
//
|
||||||
|
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||||
|
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||||
|
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||||
|
//
|
||||||
|
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||||
|
//
|
||||||
|
// long millis = System.currentTimeMillis();
|
||||||
|
//
|
||||||
|
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||||
|
// .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Example 5: Compute Timestamp from current time in Python.
|
||||||
|
//
|
||||||
|
// timestamp = Timestamp()
|
||||||
|
// timestamp.GetCurrentTime()
|
||||||
|
//
|
||||||
|
// # JSON Mapping
|
||||||
|
//
|
||||||
|
// In JSON format, the Timestamp type is encoded as a string in the
|
||||||
|
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||||
|
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||||
|
// where {year} is always expressed using four digits while {month}, {day},
|
||||||
|
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||||
|
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||||
|
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||||
|
// is required, though only UTC (as indicated by "Z") is presently supported.
|
||||||
|
//
|
||||||
|
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||||
|
// 01:30 UTC on January 15, 2017.
|
||||||
|
//
|
||||||
|
// In JavaScript, one can convert a Date object to this format using the
|
||||||
|
// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
|
||||||
|
// method. In Python, a standard `datetime.datetime` object can be converted
|
||||||
|
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
||||||
|
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
||||||
|
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||||
|
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--)
|
||||||
|
// to obtain a formatter capable of generating timestamps in this format.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
message Timestamp {
|
||||||
|
|
||||||
|
// Represents seconds of UTC time since Unix epoch
|
||||||
|
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||||
|
// 9999-12-31T23:59:59Z inclusive.
|
||||||
|
int64 seconds = 1;
|
||||||
|
|
||||||
|
// Non-negative fractions of a second at nanosecond resolution. Negative
|
||||||
|
// second values with fractions must still have non-negative nanos values
|
||||||
|
// that count forward in time. Must be from 0 to 999,999,999
|
||||||
|
// inclusive.
|
||||||
|
int32 nanos = 2;
|
||||||
|
}
|
443
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go
generated
vendored
Normal file
443
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,443 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google/protobuf/wrappers.proto
|
||||||
|
|
||||||
|
package wrappers // import "github.com/golang/protobuf/ptypes/wrappers"
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// Wrapper message for `double`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `DoubleValue` is JSON number.
|
||||||
|
type DoubleValue struct {
|
||||||
|
// The double value.
|
||||||
|
Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoubleValue) Reset() { *m = DoubleValue{} }
|
||||||
|
func (m *DoubleValue) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*DoubleValue) ProtoMessage() {}
|
||||||
|
func (*DoubleValue) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{0}
|
||||||
|
}
|
||||||
|
func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" }
|
||||||
|
func (m *DoubleValue) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_DoubleValue.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *DoubleValue) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_DoubleValue.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *DoubleValue) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_DoubleValue.Size(m)
|
||||||
|
}
|
||||||
|
func (m *DoubleValue) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_DoubleValue.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_DoubleValue proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *DoubleValue) GetValue() float64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `float`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `FloatValue` is JSON number.
|
||||||
|
type FloatValue struct {
|
||||||
|
// The float value.
|
||||||
|
Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *FloatValue) Reset() { *m = FloatValue{} }
|
||||||
|
func (m *FloatValue) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*FloatValue) ProtoMessage() {}
|
||||||
|
func (*FloatValue) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{1}
|
||||||
|
}
|
||||||
|
func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" }
|
||||||
|
func (m *FloatValue) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_FloatValue.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *FloatValue) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_FloatValue.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *FloatValue) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_FloatValue.Size(m)
|
||||||
|
}
|
||||||
|
func (m *FloatValue) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_FloatValue.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_FloatValue proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *FloatValue) GetValue() float32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `int64`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Int64Value` is JSON string.
|
||||||
|
type Int64Value struct {
|
||||||
|
// The int64 value.
|
||||||
|
Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Int64Value) Reset() { *m = Int64Value{} }
|
||||||
|
func (m *Int64Value) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Int64Value) ProtoMessage() {}
|
||||||
|
func (*Int64Value) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{2}
|
||||||
|
}
|
||||||
|
func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" }
|
||||||
|
func (m *Int64Value) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Int64Value.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Int64Value) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Int64Value.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Int64Value) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Int64Value.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Int64Value) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Int64Value.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Int64Value proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Int64Value) GetValue() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `uint64`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `UInt64Value` is JSON string.
|
||||||
|
type UInt64Value struct {
|
||||||
|
// The uint64 value.
|
||||||
|
Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UInt64Value) Reset() { *m = UInt64Value{} }
|
||||||
|
func (m *UInt64Value) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*UInt64Value) ProtoMessage() {}
|
||||||
|
func (*UInt64Value) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{3}
|
||||||
|
}
|
||||||
|
func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" }
|
||||||
|
func (m *UInt64Value) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_UInt64Value.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *UInt64Value) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_UInt64Value.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *UInt64Value) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_UInt64Value.Size(m)
|
||||||
|
}
|
||||||
|
func (m *UInt64Value) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_UInt64Value.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_UInt64Value proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *UInt64Value) GetValue() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `int32`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Int32Value` is JSON number.
|
||||||
|
type Int32Value struct {
|
||||||
|
// The int32 value.
|
||||||
|
Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Int32Value) Reset() { *m = Int32Value{} }
|
||||||
|
func (m *Int32Value) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Int32Value) ProtoMessage() {}
|
||||||
|
func (*Int32Value) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{4}
|
||||||
|
}
|
||||||
|
func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" }
|
||||||
|
func (m *Int32Value) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Int32Value.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *Int32Value) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Int32Value.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *Int32Value) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Int32Value.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Int32Value) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Int32Value.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Int32Value proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Int32Value) GetValue() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `uint32`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `UInt32Value` is JSON number.
|
||||||
|
type UInt32Value struct {
|
||||||
|
// The uint32 value.
|
||||||
|
Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UInt32Value) Reset() { *m = UInt32Value{} }
|
||||||
|
func (m *UInt32Value) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*UInt32Value) ProtoMessage() {}
|
||||||
|
func (*UInt32Value) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{5}
|
||||||
|
}
|
||||||
|
func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" }
|
||||||
|
func (m *UInt32Value) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_UInt32Value.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *UInt32Value) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_UInt32Value.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *UInt32Value) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_UInt32Value.Size(m)
|
||||||
|
}
|
||||||
|
func (m *UInt32Value) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_UInt32Value.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_UInt32Value proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *UInt32Value) GetValue() uint32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `bool`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||||
|
type BoolValue struct {
|
||||||
|
// The bool value.
|
||||||
|
Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BoolValue) Reset() { *m = BoolValue{} }
|
||||||
|
func (m *BoolValue) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*BoolValue) ProtoMessage() {}
|
||||||
|
func (*BoolValue) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{6}
|
||||||
|
}
|
||||||
|
func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" }
|
||||||
|
func (m *BoolValue) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_BoolValue.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *BoolValue) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_BoolValue.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *BoolValue) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_BoolValue.Size(m)
|
||||||
|
}
|
||||||
|
func (m *BoolValue) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_BoolValue.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_BoolValue proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *BoolValue) GetValue() bool {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `string`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `StringValue` is JSON string.
|
||||||
|
type StringValue struct {
|
||||||
|
// The string value.
|
||||||
|
Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StringValue) Reset() { *m = StringValue{} }
|
||||||
|
func (m *StringValue) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*StringValue) ProtoMessage() {}
|
||||||
|
func (*StringValue) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{7}
|
||||||
|
}
|
||||||
|
func (*StringValue) XXX_WellKnownType() string { return "StringValue" }
|
||||||
|
func (m *StringValue) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_StringValue.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_StringValue.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *StringValue) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_StringValue.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *StringValue) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_StringValue.Size(m)
|
||||||
|
}
|
||||||
|
func (m *StringValue) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_StringValue.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_StringValue proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *StringValue) GetValue() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `bytes`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `BytesValue` is JSON string.
|
||||||
|
type BytesValue struct {
|
||||||
|
// The bytes value.
|
||||||
|
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BytesValue) Reset() { *m = BytesValue{} }
|
||||||
|
func (m *BytesValue) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*BytesValue) ProtoMessage() {}
|
||||||
|
func (*BytesValue) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_wrappers_16c7c35c009f3253, []int{8}
|
||||||
|
}
|
||||||
|
func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" }
|
||||||
|
func (m *BytesValue) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_BytesValue.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *BytesValue) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_BytesValue.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *BytesValue) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_BytesValue.Size(m)
|
||||||
|
}
|
||||||
|
func (m *BytesValue) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_BytesValue.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_BytesValue proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *BytesValue) GetValue() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue")
|
||||||
|
proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue")
|
||||||
|
proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value")
|
||||||
|
proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value")
|
||||||
|
proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value")
|
||||||
|
proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value")
|
||||||
|
proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue")
|
||||||
|
proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue")
|
||||||
|
proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("google/protobuf/wrappers.proto", fileDescriptor_wrappers_16c7c35c009f3253)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_wrappers_16c7c35c009f3253 = []byte{
|
||||||
|
// 259 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
|
||||||
|
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c,
|
||||||
|
0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0xca,
|
||||||
|
0x5c, 0xdc, 0x2e, 0xf9, 0xa5, 0x49, 0x39, 0xa9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x42, 0x22, 0x5c,
|
||||||
|
0xac, 0x65, 0x20, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x63, 0x10, 0x84, 0xa3, 0xa4, 0xc4, 0xc5,
|
||||||
|
0xe5, 0x96, 0x93, 0x9f, 0x58, 0x82, 0x45, 0x0d, 0x13, 0x92, 0x1a, 0xcf, 0xbc, 0x12, 0x33, 0x13,
|
||||||
|
0x2c, 0x6a, 0x98, 0x61, 0x6a, 0x94, 0xb9, 0xb8, 0x43, 0x71, 0x29, 0x62, 0x41, 0x35, 0xc8, 0xd8,
|
||||||
|
0x08, 0x8b, 0x1a, 0x56, 0x34, 0x83, 0xb0, 0x2a, 0xe2, 0x85, 0x29, 0x52, 0xe4, 0xe2, 0x74, 0xca,
|
||||||
|
0xcf, 0xcf, 0xc1, 0xa2, 0x84, 0x03, 0xc9, 0x9c, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x2c, 0x8a,
|
||||||
|
0x38, 0x91, 0x1c, 0xe4, 0x54, 0x59, 0x92, 0x5a, 0x8c, 0x45, 0x0d, 0x0f, 0x54, 0x8d, 0x53, 0x0d,
|
||||||
|
0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x5a, 0xe8, 0x3a, 0xf1, 0x86, 0x43, 0x83, 0x3f, 0x00, 0x24,
|
||||||
|
0x12, 0xc0, 0x18, 0xa5, 0x95, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f,
|
||||||
|
0x9e, 0x9f, 0x93, 0x98, 0x97, 0x8e, 0x88, 0xaa, 0x82, 0x92, 0xca, 0x82, 0xd4, 0x62, 0x78, 0x8c,
|
||||||
|
0xfd, 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e,
|
||||||
|
0x00, 0x54, 0xa9, 0x5e, 0x78, 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b,
|
||||||
|
0x12, 0x1b, 0xd8, 0x0c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x19, 0x6c, 0xb9, 0xb8, 0xfe,
|
||||||
|
0x01, 0x00, 0x00,
|
||||||
|
}
|
118
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.proto
generated
vendored
Normal file
118
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.proto
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
// Wrappers for primitive (non-message) types. These types are useful
|
||||||
|
// for embedding primitives in the `google.protobuf.Any` type and for places
|
||||||
|
// where we need to distinguish between the absence of a primitive
|
||||||
|
// typed field and its default value.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "github.com/golang/protobuf/ptypes/wrappers";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "WrappersProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// Wrapper message for `double`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `DoubleValue` is JSON number.
|
||||||
|
message DoubleValue {
|
||||||
|
// The double value.
|
||||||
|
double value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `float`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `FloatValue` is JSON number.
|
||||||
|
message FloatValue {
|
||||||
|
// The float value.
|
||||||
|
float value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `int64`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Int64Value` is JSON string.
|
||||||
|
message Int64Value {
|
||||||
|
// The int64 value.
|
||||||
|
int64 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `uint64`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `UInt64Value` is JSON string.
|
||||||
|
message UInt64Value {
|
||||||
|
// The uint64 value.
|
||||||
|
uint64 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `int32`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Int32Value` is JSON number.
|
||||||
|
message Int32Value {
|
||||||
|
// The int32 value.
|
||||||
|
int32 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `uint32`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `UInt32Value` is JSON number.
|
||||||
|
message UInt32Value {
|
||||||
|
// The uint32 value.
|
||||||
|
uint32 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `bool`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||||
|
message BoolValue {
|
||||||
|
// The bool value.
|
||||||
|
bool value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `string`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `StringValue` is JSON string.
|
||||||
|
message StringValue {
|
||||||
|
// The string value.
|
||||||
|
string value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `bytes`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `BytesValue` is JSON string.
|
||||||
|
message BytesValue {
|
||||||
|
// The bytes value.
|
||||||
|
bytes value = 1;
|
||||||
|
}
|
27
vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt
generated
vendored
Normal file
27
vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 2015, Gengo, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of Gengo, Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
22
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel
generated
vendored
Normal file
22
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||||
|
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
|
||||||
|
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
proto_library(
|
||||||
|
name = "internal_proto",
|
||||||
|
srcs = ["stream_chunk.proto"],
|
||||||
|
deps = ["@com_google_protobuf//:any_proto"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_proto_library(
|
||||||
|
name = "internal_go_proto",
|
||||||
|
importpath = "github.com/grpc-ecosystem/grpc-gateway/internal",
|
||||||
|
proto = ":internal_proto",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
embed = [":internal_go_proto"],
|
||||||
|
importpath = "github.com/grpc-ecosystem/grpc-gateway/internal",
|
||||||
|
)
|
118
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.pb.go
generated
vendored
Normal file
118
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: internal/stream_chunk.proto
|
||||||
|
|
||||||
|
package internal
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
import any "github.com/golang/protobuf/ptypes/any"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// StreamError is a response type which is returned when
|
||||||
|
// streaming rpc returns an error.
|
||||||
|
type StreamError struct {
|
||||||
|
GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode,proto3" json:"grpc_code,omitempty"`
|
||||||
|
HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode,proto3" json:"http_code,omitempty"`
|
||||||
|
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
|
HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"`
|
||||||
|
Details []*any.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StreamError) Reset() { *m = StreamError{} }
|
||||||
|
func (m *StreamError) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*StreamError) ProtoMessage() {}
|
||||||
|
func (*StreamError) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_stream_chunk_cac6867f460b29a5, []int{0}
|
||||||
|
}
|
||||||
|
func (m *StreamError) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_StreamError.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *StreamError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_StreamError.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *StreamError) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_StreamError.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *StreamError) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_StreamError.Size(m)
|
||||||
|
}
|
||||||
|
func (m *StreamError) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_StreamError.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_StreamError proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *StreamError) GetGrpcCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.GrpcCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StreamError) GetHttpCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.HttpCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StreamError) GetMessage() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Message
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StreamError) GetHttpStatus() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.HttpStatus
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StreamError) GetDetails() []*any.Any {
|
||||||
|
if m != nil {
|
||||||
|
return m.Details
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_stream_chunk_cac6867f460b29a5)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_stream_chunk_cac6867f460b29a5 = []byte{
|
||||||
|
// 223 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x41, 0x4e, 0xc3, 0x30,
|
||||||
|
0x10, 0x45, 0x15, 0x4a, 0x69, 0x3b, 0xd9, 0x45, 0x5d, 0x18, 0xba, 0x20, 0x62, 0x95, 0x95, 0x23,
|
||||||
|
0xc1, 0x09, 0x00, 0x71, 0x81, 0x74, 0xc7, 0xa6, 0x9a, 0x26, 0x83, 0x13, 0x91, 0xd8, 0xd1, 0x78,
|
||||||
|
0x22, 0x94, 0x6b, 0x71, 0xc2, 0xca, 0x8e, 0xb2, 0xf4, 0x7b, 0x7f, 0xbe, 0xbe, 0x0c, 0xa7, 0xce,
|
||||||
|
0x0a, 0xb1, 0xc5, 0xbe, 0xf4, 0xc2, 0x84, 0xc3, 0xa5, 0x6e, 0x27, 0xfb, 0xab, 0x47, 0x76, 0xe2,
|
||||||
|
0xb2, 0xa3, 0xe1, 0xb1, 0xd6, 0x06, 0x85, 0xfe, 0x70, 0xd6, 0x3c, 0x59, 0xe9, 0x06, 0x7a, 0x7a,
|
||||||
|
0x34, 0xce, 0x99, 0x9e, 0xca, 0x98, 0xb9, 0x4e, 0x3f, 0x25, 0xda, 0x79, 0x39, 0x78, 0xf9, 0x4f,
|
||||||
|
0x20, 0x3d, 0xc7, 0x9e, 0x2f, 0x66, 0xc7, 0xd9, 0x09, 0x0e, 0xa1, 0xe2, 0x52, 0xbb, 0x86, 0x54,
|
||||||
|
0x92, 0x27, 0xc5, 0xb6, 0xda, 0x07, 0xf0, 0xe9, 0x1a, 0x0a, 0xb2, 0x15, 0x19, 0x17, 0x79, 0xb7,
|
||||||
|
0xc8, 0x00, 0xa2, 0x54, 0xb0, 0x1b, 0xc8, 0x7b, 0x34, 0xa4, 0x36, 0x79, 0x52, 0x1c, 0xaa, 0xf5,
|
||||||
|
0x99, 0x3d, 0x43, 0x1a, 0xcf, 0xbc, 0xa0, 0x4c, 0x5e, 0xdd, 0x47, 0x0b, 0x01, 0x9d, 0x23, 0xc9,
|
||||||
|
0x34, 0xec, 0x1a, 0x12, 0xec, 0x7a, 0xaf, 0xb6, 0xf9, 0xa6, 0x48, 0x5f, 0x8f, 0x7a, 0x59, 0xac,
|
||||||
|
0xd7, 0xc5, 0xfa, 0xdd, 0xce, 0xd5, 0x1a, 0xfa, 0x80, 0xef, 0xfd, 0xfa, 0x09, 0xd7, 0x87, 0x18,
|
||||||
|
0x79, 0xbb, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x7d, 0xa5, 0x18, 0x17, 0x01, 0x00, 0x00,
|
||||||
|
}
|
15
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.proto
generated
vendored
Normal file
15
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.proto
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package grpc.gateway.runtime;
|
||||||
|
option go_package = "internal";
|
||||||
|
|
||||||
|
import "google/protobuf/any.proto";
|
||||||
|
|
||||||
|
// StreamError is a response type which is returned when
|
||||||
|
// streaming rpc returns an error.
|
||||||
|
message StreamError {
|
||||||
|
int32 grpc_code = 1;
|
||||||
|
int32 http_code = 2;
|
||||||
|
string message = 3;
|
||||||
|
string http_status = 4;
|
||||||
|
repeated google.protobuf.Any details = 5;
|
||||||
|
}
|
80
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel
generated
vendored
Normal file
80
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
||||||
|
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"context.go",
|
||||||
|
"convert.go",
|
||||||
|
"doc.go",
|
||||||
|
"errors.go",
|
||||||
|
"fieldmask.go",
|
||||||
|
"handler.go",
|
||||||
|
"marshal_json.go",
|
||||||
|
"marshal_jsonpb.go",
|
||||||
|
"marshal_proto.go",
|
||||||
|
"marshaler.go",
|
||||||
|
"marshaler_registry.go",
|
||||||
|
"mux.go",
|
||||||
|
"pattern.go",
|
||||||
|
"proto2_convert.go",
|
||||||
|
"proto_errors.go",
|
||||||
|
"query.go",
|
||||||
|
],
|
||||||
|
importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime",
|
||||||
|
deps = [
|
||||||
|
"//internal:go_default_library",
|
||||||
|
"//utilities:go_default_library",
|
||||||
|
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
|
||||||
|
"@com_github_golang_protobuf//proto:go_default_library",
|
||||||
|
"@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:any_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:field_mask_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:wrappers_go_proto",
|
||||||
|
"@org_golang_google_grpc//codes:go_default_library",
|
||||||
|
"@org_golang_google_grpc//grpclog:go_default_library",
|
||||||
|
"@org_golang_google_grpc//metadata:go_default_library",
|
||||||
|
"@org_golang_google_grpc//status:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
size = "small",
|
||||||
|
srcs = [
|
||||||
|
"context_test.go",
|
||||||
|
"errors_test.go",
|
||||||
|
"fieldmask_test.go",
|
||||||
|
"handler_test.go",
|
||||||
|
"marshal_json_test.go",
|
||||||
|
"marshal_jsonpb_test.go",
|
||||||
|
"marshal_proto_test.go",
|
||||||
|
"marshaler_registry_test.go",
|
||||||
|
"mux_test.go",
|
||||||
|
"pattern_test.go",
|
||||||
|
"query_test.go",
|
||||||
|
],
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
deps = [
|
||||||
|
"//examples/proto/examplepb:go_default_library",
|
||||||
|
"//internal:go_default_library",
|
||||||
|
"//utilities:go_default_library",
|
||||||
|
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
|
||||||
|
"@com_github_golang_protobuf//proto:go_default_library",
|
||||||
|
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
|
||||||
|
"@go_googleapis//google/rpc:errdetails_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:field_mask_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:struct_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
|
||||||
|
"@io_bazel_rules_go//proto/wkt:wrappers_go_proto",
|
||||||
|
"@org_golang_google_grpc//:go_default_library",
|
||||||
|
"@org_golang_google_grpc//codes:go_default_library",
|
||||||
|
"@org_golang_google_grpc//metadata:go_default_library",
|
||||||
|
"@org_golang_google_grpc//status:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
210
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go
generated
vendored
Normal file
210
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go
generated
vendored
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"net/textproto"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MetadataHeaderPrefix is the http prefix that represents custom metadata
|
||||||
|
// parameters to or from a gRPC call.
|
||||||
|
const MetadataHeaderPrefix = "Grpc-Metadata-"
|
||||||
|
|
||||||
|
// MetadataPrefix is prepended to permanent HTTP header keys (as specified
|
||||||
|
// by the IANA) when added to the gRPC context.
|
||||||
|
const MetadataPrefix = "grpcgateway-"
|
||||||
|
|
||||||
|
// MetadataTrailerPrefix is prepended to gRPC metadata as it is converted to
|
||||||
|
// HTTP headers in a response handled by grpc-gateway
|
||||||
|
const MetadataTrailerPrefix = "Grpc-Trailer-"
|
||||||
|
|
||||||
|
const metadataGrpcTimeout = "Grpc-Timeout"
|
||||||
|
const metadataHeaderBinarySuffix = "-Bin"
|
||||||
|
|
||||||
|
const xForwardedFor = "X-Forwarded-For"
|
||||||
|
const xForwardedHost = "X-Forwarded-Host"
|
||||||
|
|
||||||
|
var (
|
||||||
|
// DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound
|
||||||
|
// header isn't present. If the value is 0 the sent `context` will not have a timeout.
|
||||||
|
DefaultContextTimeout = 0 * time.Second
|
||||||
|
)
|
||||||
|
|
||||||
|
func decodeBinHeader(v string) ([]byte, error) {
|
||||||
|
if len(v)%4 == 0 {
|
||||||
|
// Input was padded, or padding was not necessary.
|
||||||
|
return base64.StdEncoding.DecodeString(v)
|
||||||
|
}
|
||||||
|
return base64.RawStdEncoding.DecodeString(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AnnotateContext adds context information such as metadata from the request.
|
||||||
|
|
||||||
|
At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For",
|
||||||
|
except that the forwarded destination is not another HTTP service but rather
|
||||||
|
a gRPC service.
|
||||||
|
*/
|
||||||
|
func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (context.Context, error) {
|
||||||
|
var pairs []string
|
||||||
|
timeout := DefaultContextTimeout
|
||||||
|
if tm := req.Header.Get(metadataGrpcTimeout); tm != "" {
|
||||||
|
var err error
|
||||||
|
timeout, err = timeoutDecode(tm)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, vals := range req.Header {
|
||||||
|
for _, val := range vals {
|
||||||
|
key = textproto.CanonicalMIMEHeaderKey(key)
|
||||||
|
// For backwards-compatibility, pass through 'authorization' header with no prefix.
|
||||||
|
if key == "Authorization" {
|
||||||
|
pairs = append(pairs, "authorization", val)
|
||||||
|
}
|
||||||
|
if h, ok := mux.incomingHeaderMatcher(key); ok {
|
||||||
|
// Handles "-bin" metadata in grpc, since grpc will do another base64
|
||||||
|
// encode before sending to server, we need to decode it first.
|
||||||
|
if strings.HasSuffix(key, metadataHeaderBinarySuffix) {
|
||||||
|
b, err := decodeBinHeader(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.InvalidArgument, "invalid binary header %s: %s", key, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
val = string(b)
|
||||||
|
}
|
||||||
|
pairs = append(pairs, h, val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if host := req.Header.Get(xForwardedHost); host != "" {
|
||||||
|
pairs = append(pairs, strings.ToLower(xForwardedHost), host)
|
||||||
|
} else if req.Host != "" {
|
||||||
|
pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host)
|
||||||
|
}
|
||||||
|
|
||||||
|
if addr := req.RemoteAddr; addr != "" {
|
||||||
|
if remoteIP, _, err := net.SplitHostPort(addr); err == nil {
|
||||||
|
if fwd := req.Header.Get(xForwardedFor); fwd == "" {
|
||||||
|
pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIP)
|
||||||
|
} else {
|
||||||
|
pairs = append(pairs, strings.ToLower(xForwardedFor), fmt.Sprintf("%s, %s", fwd, remoteIP))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
grpclog.Infof("invalid remote addr: %s", addr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if timeout != 0 {
|
||||||
|
ctx, _ = context.WithTimeout(ctx, timeout)
|
||||||
|
}
|
||||||
|
if len(pairs) == 0 {
|
||||||
|
return ctx, nil
|
||||||
|
}
|
||||||
|
md := metadata.Pairs(pairs...)
|
||||||
|
for _, mda := range mux.metadataAnnotators {
|
||||||
|
md = metadata.Join(md, mda(ctx, req))
|
||||||
|
}
|
||||||
|
return metadata.NewOutgoingContext(ctx, md), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerMetadata consists of metadata sent from gRPC server.
|
||||||
|
type ServerMetadata struct {
|
||||||
|
HeaderMD metadata.MD
|
||||||
|
TrailerMD metadata.MD
|
||||||
|
}
|
||||||
|
|
||||||
|
type serverMetadataKey struct{}
|
||||||
|
|
||||||
|
// NewServerMetadataContext creates a new context with ServerMetadata
|
||||||
|
func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context {
|
||||||
|
return context.WithValue(ctx, serverMetadataKey{}, md)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerMetadataFromContext returns the ServerMetadata in ctx
|
||||||
|
func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) {
|
||||||
|
md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func timeoutDecode(s string) (time.Duration, error) {
|
||||||
|
size := len(s)
|
||||||
|
if size < 2 {
|
||||||
|
return 0, fmt.Errorf("timeout string is too short: %q", s)
|
||||||
|
}
|
||||||
|
d, ok := timeoutUnitToDuration(s[size-1])
|
||||||
|
if !ok {
|
||||||
|
return 0, fmt.Errorf("timeout unit is not recognized: %q", s)
|
||||||
|
}
|
||||||
|
t, err := strconv.ParseInt(s[:size-1], 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return d * time.Duration(t), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) {
|
||||||
|
switch u {
|
||||||
|
case 'H':
|
||||||
|
return time.Hour, true
|
||||||
|
case 'M':
|
||||||
|
return time.Minute, true
|
||||||
|
case 'S':
|
||||||
|
return time.Second, true
|
||||||
|
case 'm':
|
||||||
|
return time.Millisecond, true
|
||||||
|
case 'u':
|
||||||
|
return time.Microsecond, true
|
||||||
|
case 'n':
|
||||||
|
return time.Nanosecond, true
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// isPermanentHTTPHeader checks whether hdr belongs to the list of
|
||||||
|
// permenant request headers maintained by IANA.
|
||||||
|
// http://www.iana.org/assignments/message-headers/message-headers.xml
|
||||||
|
func isPermanentHTTPHeader(hdr string) bool {
|
||||||
|
switch hdr {
|
||||||
|
case
|
||||||
|
"Accept",
|
||||||
|
"Accept-Charset",
|
||||||
|
"Accept-Language",
|
||||||
|
"Accept-Ranges",
|
||||||
|
"Authorization",
|
||||||
|
"Cache-Control",
|
||||||
|
"Content-Type",
|
||||||
|
"Cookie",
|
||||||
|
"Date",
|
||||||
|
"Expect",
|
||||||
|
"From",
|
||||||
|
"Host",
|
||||||
|
"If-Match",
|
||||||
|
"If-Modified-Since",
|
||||||
|
"If-None-Match",
|
||||||
|
"If-Schedule-Tag-Match",
|
||||||
|
"If-Unmodified-Since",
|
||||||
|
"Max-Forwards",
|
||||||
|
"Origin",
|
||||||
|
"Pragma",
|
||||||
|
"Referer",
|
||||||
|
"User-Agent",
|
||||||
|
"Via",
|
||||||
|
"Warning":
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
312
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go
generated
vendored
Normal file
312
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go
generated
vendored
Normal file
|
@ -0,0 +1,312 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/jsonpb"
|
||||||
|
"github.com/golang/protobuf/ptypes/duration"
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
|
"github.com/golang/protobuf/ptypes/wrappers"
|
||||||
|
)
|
||||||
|
|
||||||
|
// String just returns the given string.
|
||||||
|
// It is just for compatibility to other types.
|
||||||
|
func String(val string) (string, error) {
|
||||||
|
return val, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringSlice converts 'val' where individual strings are separated by
|
||||||
|
// 'sep' into a string slice.
|
||||||
|
func StringSlice(val, sep string) ([]string, error) {
|
||||||
|
return strings.Split(val, sep), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bool converts the given string representation of a boolean value into bool.
|
||||||
|
func Bool(val string) (bool, error) {
|
||||||
|
return strconv.ParseBool(val)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolSlice converts 'val' where individual booleans are separated by
|
||||||
|
// 'sep' into a bool slice.
|
||||||
|
func BoolSlice(val, sep string) ([]bool, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]bool, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Bool(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float64 converts the given string representation into representation of a floating point number into float64.
|
||||||
|
func Float64(val string) (float64, error) {
|
||||||
|
return strconv.ParseFloat(val, 64)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float64Slice converts 'val' where individual floating point numbers are separated by
|
||||||
|
// 'sep' into a float64 slice.
|
||||||
|
func Float64Slice(val, sep string) ([]float64, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]float64, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Float64(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float32 converts the given string representation of a floating point number into float32.
|
||||||
|
func Float32(val string) (float32, error) {
|
||||||
|
f, err := strconv.ParseFloat(val, 32)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return float32(f), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float32Slice converts 'val' where individual floating point numbers are separated by
|
||||||
|
// 'sep' into a float32 slice.
|
||||||
|
func Float32Slice(val, sep string) ([]float32, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]float32, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Float32(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64 converts the given string representation of an integer into int64.
|
||||||
|
func Int64(val string) (int64, error) {
|
||||||
|
return strconv.ParseInt(val, 0, 64)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64Slice converts 'val' where individual integers are separated by
|
||||||
|
// 'sep' into a int64 slice.
|
||||||
|
func Int64Slice(val, sep string) ([]int64, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]int64, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Int64(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int32 converts the given string representation of an integer into int32.
|
||||||
|
func Int32(val string) (int32, error) {
|
||||||
|
i, err := strconv.ParseInt(val, 0, 32)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return int32(i), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int32Slice converts 'val' where individual integers are separated by
|
||||||
|
// 'sep' into a int32 slice.
|
||||||
|
func Int32Slice(val, sep string) ([]int32, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]int32, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Int32(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint64 converts the given string representation of an integer into uint64.
|
||||||
|
func Uint64(val string) (uint64, error) {
|
||||||
|
return strconv.ParseUint(val, 0, 64)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint64Slice converts 'val' where individual integers are separated by
|
||||||
|
// 'sep' into a uint64 slice.
|
||||||
|
func Uint64Slice(val, sep string) ([]uint64, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]uint64, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Uint64(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint32 converts the given string representation of an integer into uint32.
|
||||||
|
func Uint32(val string) (uint32, error) {
|
||||||
|
i, err := strconv.ParseUint(val, 0, 32)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return uint32(i), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint32Slice converts 'val' where individual integers are separated by
|
||||||
|
// 'sep' into a uint32 slice.
|
||||||
|
func Uint32Slice(val, sep string) ([]uint32, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]uint32, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Uint32(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bytes converts the given string representation of a byte sequence into a slice of bytes
|
||||||
|
// A bytes sequence is encoded in URL-safe base64 without padding
|
||||||
|
func Bytes(val string) ([]byte, error) {
|
||||||
|
b, err := base64.StdEncoding.DecodeString(val)
|
||||||
|
if err != nil {
|
||||||
|
b, err = base64.URLEncoding.DecodeString(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// BytesSlice converts 'val' where individual bytes sequences, encoded in URL-safe
|
||||||
|
// base64 without padding, are separated by 'sep' into a slice of bytes slices slice.
|
||||||
|
func BytesSlice(val, sep string) ([][]byte, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([][]byte, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Bytes(v)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp.
|
||||||
|
func Timestamp(val string) (*timestamp.Timestamp, error) {
|
||||||
|
var r *timestamp.Timestamp
|
||||||
|
err := jsonpb.UnmarshalString(val, r)
|
||||||
|
return r, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duration converts the given string into a timestamp.Duration.
|
||||||
|
func Duration(val string) (*duration.Duration, error) {
|
||||||
|
var r *duration.Duration
|
||||||
|
err := jsonpb.UnmarshalString(val, r)
|
||||||
|
return r, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enum converts the given string into an int32 that should be type casted into the
|
||||||
|
// correct enum proto type.
|
||||||
|
func Enum(val string, enumValMap map[string]int32) (int32, error) {
|
||||||
|
e, ok := enumValMap[val]
|
||||||
|
if ok {
|
||||||
|
return e, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
i, err := Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return 0, fmt.Errorf("%s is not valid", val)
|
||||||
|
}
|
||||||
|
for _, v := range enumValMap {
|
||||||
|
if v == i {
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0, fmt.Errorf("%s is not valid", val)
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnumSlice converts 'val' where individual enums are separated by 'sep'
|
||||||
|
// into a int32 slice. Each individual int32 should be type casted into the
|
||||||
|
// correct enum proto type.
|
||||||
|
func EnumSlice(val, sep string, enumValMap map[string]int32) ([]int32, error) {
|
||||||
|
s := strings.Split(val, sep)
|
||||||
|
values := make([]int32, len(s))
|
||||||
|
for i, v := range s {
|
||||||
|
value, err := Enum(v, enumValMap)
|
||||||
|
if err != nil {
|
||||||
|
return values, err
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Support fot google.protobuf.wrappers on top of primitive types
|
||||||
|
*/
|
||||||
|
|
||||||
|
// StringValue well-known type support as wrapper around string type
|
||||||
|
func StringValue(val string) (*wrappers.StringValue, error) {
|
||||||
|
return &wrappers.StringValue{Value: val}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FloatValue well-known type support as wrapper around float32 type
|
||||||
|
func FloatValue(val string) (*wrappers.FloatValue, error) {
|
||||||
|
parsedVal, err := Float32(val)
|
||||||
|
return &wrappers.FloatValue{Value: parsedVal}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DoubleValue well-known type support as wrapper around float64 type
|
||||||
|
func DoubleValue(val string) (*wrappers.DoubleValue, error) {
|
||||||
|
parsedVal, err := Float64(val)
|
||||||
|
return &wrappers.DoubleValue{Value: parsedVal}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolValue well-known type support as wrapper around bool type
|
||||||
|
func BoolValue(val string) (*wrappers.BoolValue, error) {
|
||||||
|
parsedVal, err := Bool(val)
|
||||||
|
return &wrappers.BoolValue{Value: parsedVal}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int32Value well-known type support as wrapper around int32 type
|
||||||
|
func Int32Value(val string) (*wrappers.Int32Value, error) {
|
||||||
|
parsedVal, err := Int32(val)
|
||||||
|
return &wrappers.Int32Value{Value: parsedVal}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UInt32Value well-known type support as wrapper around uint32 type
|
||||||
|
func UInt32Value(val string) (*wrappers.UInt32Value, error) {
|
||||||
|
parsedVal, err := Uint32(val)
|
||||||
|
return &wrappers.UInt32Value{Value: parsedVal}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64Value well-known type support as wrapper around int64 type
|
||||||
|
func Int64Value(val string) (*wrappers.Int64Value, error) {
|
||||||
|
parsedVal, err := Int64(val)
|
||||||
|
return &wrappers.Int64Value{Value: parsedVal}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UInt64Value well-known type support as wrapper around uint64 type
|
||||||
|
func UInt64Value(val string) (*wrappers.UInt64Value, error) {
|
||||||
|
parsedVal, err := Uint64(val)
|
||||||
|
return &wrappers.UInt64Value{Value: parsedVal}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// BytesValue well-known type support as wrapper around bytes[] type
|
||||||
|
func BytesValue(val string) (*wrappers.BytesValue, error) {
|
||||||
|
parsedVal, err := Bytes(val)
|
||||||
|
return &wrappers.BytesValue{Value: parsedVal}, err
|
||||||
|
}
|
5
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go
generated
vendored
Normal file
5
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/*
|
||||||
|
Package runtime contains runtime helper functions used by
|
||||||
|
servers which protoc-gen-grpc-gateway generates.
|
||||||
|
*/
|
||||||
|
package runtime
|
136
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go
generated
vendored
Normal file
136
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go
generated
vendored
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/golang/protobuf/ptypes/any"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status.
|
||||||
|
// See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
|
||||||
|
func HTTPStatusFromCode(code codes.Code) int {
|
||||||
|
switch code {
|
||||||
|
case codes.OK:
|
||||||
|
return http.StatusOK
|
||||||
|
case codes.Canceled:
|
||||||
|
return http.StatusRequestTimeout
|
||||||
|
case codes.Unknown:
|
||||||
|
return http.StatusInternalServerError
|
||||||
|
case codes.InvalidArgument:
|
||||||
|
return http.StatusBadRequest
|
||||||
|
case codes.DeadlineExceeded:
|
||||||
|
return http.StatusGatewayTimeout
|
||||||
|
case codes.NotFound:
|
||||||
|
return http.StatusNotFound
|
||||||
|
case codes.AlreadyExists:
|
||||||
|
return http.StatusConflict
|
||||||
|
case codes.PermissionDenied:
|
||||||
|
return http.StatusForbidden
|
||||||
|
case codes.Unauthenticated:
|
||||||
|
return http.StatusUnauthorized
|
||||||
|
case codes.ResourceExhausted:
|
||||||
|
return http.StatusTooManyRequests
|
||||||
|
case codes.FailedPrecondition:
|
||||||
|
return http.StatusPreconditionFailed
|
||||||
|
case codes.Aborted:
|
||||||
|
return http.StatusConflict
|
||||||
|
case codes.OutOfRange:
|
||||||
|
return http.StatusBadRequest
|
||||||
|
case codes.Unimplemented:
|
||||||
|
return http.StatusNotImplemented
|
||||||
|
case codes.Internal:
|
||||||
|
return http.StatusInternalServerError
|
||||||
|
case codes.Unavailable:
|
||||||
|
return http.StatusServiceUnavailable
|
||||||
|
case codes.DataLoss:
|
||||||
|
return http.StatusInternalServerError
|
||||||
|
}
|
||||||
|
|
||||||
|
grpclog.Infof("Unknown gRPC error code: %v", code)
|
||||||
|
return http.StatusInternalServerError
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// HTTPError replies to the request with the error.
|
||||||
|
// You can set a custom function to this variable to customize error format.
|
||||||
|
HTTPError = DefaultHTTPError
|
||||||
|
// OtherErrorHandler handles the following error used by the gateway: StatusMethodNotAllowed StatusNotFound and StatusBadRequest
|
||||||
|
OtherErrorHandler = DefaultOtherErrorHandler
|
||||||
|
)
|
||||||
|
|
||||||
|
type errorBody struct {
|
||||||
|
Error string `protobuf:"bytes,1,name=error" json:"error"`
|
||||||
|
// This is to make the error more compatible with users that expect errors to be Status objects:
|
||||||
|
// https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto
|
||||||
|
// It should be the exact same message as the Error field.
|
||||||
|
Message string `protobuf:"bytes,1,name=message" json:"message"`
|
||||||
|
Code int32 `protobuf:"varint,2,name=code" json:"code"`
|
||||||
|
Details []*any.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make this also conform to proto.Message for builtin JSONPb Marshaler
|
||||||
|
func (e *errorBody) Reset() { *e = errorBody{} }
|
||||||
|
func (e *errorBody) String() string { return proto.CompactTextString(e) }
|
||||||
|
func (*errorBody) ProtoMessage() {}
|
||||||
|
|
||||||
|
// DefaultHTTPError is the default implementation of HTTPError.
|
||||||
|
// If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode.
|
||||||
|
// If otherwise, it replies with http.StatusInternalServerError.
|
||||||
|
//
|
||||||
|
// The response body returned by this function is a JSON object,
|
||||||
|
// which contains a member whose key is "error" and whose value is err.Error().
|
||||||
|
func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) {
|
||||||
|
const fallback = `{"error": "failed to marshal error message"}`
|
||||||
|
|
||||||
|
w.Header().Del("Trailer")
|
||||||
|
w.Header().Set("Content-Type", marshaler.ContentType())
|
||||||
|
|
||||||
|
s, ok := status.FromError(err)
|
||||||
|
if !ok {
|
||||||
|
s = status.New(codes.Unknown, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
body := &errorBody{
|
||||||
|
Error: s.Message(),
|
||||||
|
Message: s.Message(),
|
||||||
|
Code: int32(s.Code()),
|
||||||
|
Details: s.Proto().GetDetails(),
|
||||||
|
}
|
||||||
|
|
||||||
|
buf, merr := marshaler.Marshal(body)
|
||||||
|
if merr != nil {
|
||||||
|
grpclog.Infof("Failed to marshal error message %q: %v", body, merr)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
if _, err := io.WriteString(w, fallback); err != nil {
|
||||||
|
grpclog.Infof("Failed to write response: %v", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
md, ok := ServerMetadataFromContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
grpclog.Infof("Failed to extract ServerMetadata from context")
|
||||||
|
}
|
||||||
|
|
||||||
|
handleForwardResponseServerMetadata(w, mux, md)
|
||||||
|
handleForwardResponseTrailerHeader(w, md)
|
||||||
|
st := HTTPStatusFromCode(s.Code())
|
||||||
|
w.WriteHeader(st)
|
||||||
|
if _, err := w.Write(buf); err != nil {
|
||||||
|
grpclog.Infof("Failed to write response: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleForwardResponseTrailer(w, md)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultOtherErrorHandler is the default implementation of OtherErrorHandler.
|
||||||
|
// It simply writes a string representation of the given error into "w".
|
||||||
|
func DefaultOtherErrorHandler(w http.ResponseWriter, _ *http.Request, msg string, code int) {
|
||||||
|
http.Error(w, msg, code)
|
||||||
|
}
|
70
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/fieldmask.go
generated
vendored
Normal file
70
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/fieldmask.go
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/protoc-gen-go/generator"
|
||||||
|
"google.golang.org/genproto/protobuf/field_mask"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FieldMaskFromRequestBody creates a FieldMask printing all complete paths from the JSON body.
|
||||||
|
func FieldMaskFromRequestBody(r io.Reader) (*field_mask.FieldMask, error) {
|
||||||
|
fm := &field_mask.FieldMask{}
|
||||||
|
var root interface{}
|
||||||
|
if err := json.NewDecoder(r).Decode(&root); err != nil {
|
||||||
|
if err == io.EOF {
|
||||||
|
return fm, nil
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
queue := []fieldMaskPathItem{{node: root}}
|
||||||
|
for len(queue) > 0 {
|
||||||
|
// dequeue an item
|
||||||
|
item := queue[0]
|
||||||
|
queue = queue[1:]
|
||||||
|
|
||||||
|
if m, ok := item.node.(map[string]interface{}); ok {
|
||||||
|
// if the item is an object, then enqueue all of its children
|
||||||
|
for k, v := range m {
|
||||||
|
queue = append(queue, fieldMaskPathItem{path: append(item.path, generator.CamelCase(k)), node: v})
|
||||||
|
}
|
||||||
|
} else if len(item.path) > 0 {
|
||||||
|
// otherwise, it's a leaf node so print its path
|
||||||
|
fm.Paths = append(fm.Paths, strings.Join(item.path, "."))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fm, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// fieldMaskPathItem stores a in-progress deconstruction of a path for a fieldmask
|
||||||
|
type fieldMaskPathItem struct {
|
||||||
|
// the list of prior fields leading up to node
|
||||||
|
path []string
|
||||||
|
|
||||||
|
// a generic decoded json object the current item to inspect for further path extraction
|
||||||
|
node interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CamelCaseFieldMask updates the given FieldMask by converting all of its paths to CamelCase, using the same heuristic
|
||||||
|
// that's used for naming protobuf fields in Go.
|
||||||
|
func CamelCaseFieldMask(mask *field_mask.FieldMask) {
|
||||||
|
if mask == nil || mask.Paths == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var newPaths []string
|
||||||
|
for _, path := range mask.Paths {
|
||||||
|
lowerCasedParts := strings.Split(path, ".")
|
||||||
|
var camelCasedParts []string
|
||||||
|
for _, part := range lowerCasedParts {
|
||||||
|
camelCasedParts = append(camelCasedParts, generator.CamelCase(part))
|
||||||
|
}
|
||||||
|
newPaths = append(newPaths, strings.Join(camelCasedParts, "."))
|
||||||
|
}
|
||||||
|
|
||||||
|
mask.Paths = newPaths
|
||||||
|
}
|
206
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go
generated
vendored
Normal file
206
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go
generated
vendored
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"net/textproto"
|
||||||
|
|
||||||
|
"context"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/golang/protobuf/ptypes/any"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/internal"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ForwardResponseStream forwards the stream from gRPC server to REST client.
|
||||||
|
func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) {
|
||||||
|
f, ok := w.(http.Flusher)
|
||||||
|
if !ok {
|
||||||
|
grpclog.Infof("Flush not supported in %T", w)
|
||||||
|
http.Error(w, "unexpected type of web server", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
md, ok := ServerMetadataFromContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
grpclog.Infof("Failed to extract ServerMetadata from context")
|
||||||
|
http.Error(w, "unexpected error", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
handleForwardResponseServerMetadata(w, mux, md)
|
||||||
|
|
||||||
|
w.Header().Set("Transfer-Encoding", "chunked")
|
||||||
|
w.Header().Set("Content-Type", marshaler.ContentType())
|
||||||
|
if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil {
|
||||||
|
HTTPError(ctx, mux, marshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var delimiter []byte
|
||||||
|
if d, ok := marshaler.(Delimited); ok {
|
||||||
|
delimiter = d.Delimiter()
|
||||||
|
} else {
|
||||||
|
delimiter = []byte("\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
var wroteHeader bool
|
||||||
|
for {
|
||||||
|
resp, err := recv()
|
||||||
|
if err == io.EOF {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
handleForwardResponseStreamError(wroteHeader, marshaler, w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil {
|
||||||
|
handleForwardResponseStreamError(wroteHeader, marshaler, w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
buf, err := marshaler.Marshal(streamChunk(resp, nil))
|
||||||
|
if err != nil {
|
||||||
|
grpclog.Infof("Failed to marshal response chunk: %v", err)
|
||||||
|
handleForwardResponseStreamError(wroteHeader, marshaler, w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err = w.Write(buf); err != nil {
|
||||||
|
grpclog.Infof("Failed to send response chunk: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wroteHeader = true
|
||||||
|
if _, err = w.Write(delimiter); err != nil {
|
||||||
|
grpclog.Infof("Failed to send delimiter chunk: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
f.Flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleForwardResponseServerMetadata(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) {
|
||||||
|
for k, vs := range md.HeaderMD {
|
||||||
|
if h, ok := mux.outgoingHeaderMatcher(k); ok {
|
||||||
|
for _, v := range vs {
|
||||||
|
w.Header().Add(h, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleForwardResponseTrailerHeader(w http.ResponseWriter, md ServerMetadata) {
|
||||||
|
for k := range md.TrailerMD {
|
||||||
|
tKey := textproto.CanonicalMIMEHeaderKey(fmt.Sprintf("%s%s", MetadataTrailerPrefix, k))
|
||||||
|
w.Header().Add("Trailer", tKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) {
|
||||||
|
for k, vs := range md.TrailerMD {
|
||||||
|
tKey := fmt.Sprintf("%s%s", MetadataTrailerPrefix, k)
|
||||||
|
for _, v := range vs {
|
||||||
|
w.Header().Add(tKey, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// responseBody interface contains method for getting field for marshaling to the response body
|
||||||
|
// this method is generated for response struct from the value of `response_body` in the `google.api.HttpRule`
|
||||||
|
type responseBody interface {
|
||||||
|
XXX_ResponseBody() interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ForwardResponseMessage forwards the message "resp" from gRPC server to REST client.
|
||||||
|
func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) {
|
||||||
|
md, ok := ServerMetadataFromContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
grpclog.Infof("Failed to extract ServerMetadata from context")
|
||||||
|
}
|
||||||
|
|
||||||
|
handleForwardResponseServerMetadata(w, mux, md)
|
||||||
|
handleForwardResponseTrailerHeader(w, md)
|
||||||
|
w.Header().Set("Content-Type", marshaler.ContentType())
|
||||||
|
if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil {
|
||||||
|
HTTPError(ctx, mux, marshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var buf []byte
|
||||||
|
var err error
|
||||||
|
if rb, ok := resp.(responseBody); ok {
|
||||||
|
buf, err = marshaler.Marshal(rb.XXX_ResponseBody())
|
||||||
|
} else {
|
||||||
|
buf, err = marshaler.Marshal(resp)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
grpclog.Infof("Marshal error: %v", err)
|
||||||
|
HTTPError(ctx, mux, marshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = w.Write(buf); err != nil {
|
||||||
|
grpclog.Infof("Failed to write response: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleForwardResponseTrailer(w, md)
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, resp proto.Message, opts []func(context.Context, http.ResponseWriter, proto.Message) error) error {
|
||||||
|
if len(opts) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
for _, opt := range opts {
|
||||||
|
if err := opt(ctx, w, resp); err != nil {
|
||||||
|
grpclog.Infof("Error handling ForwardResponseOptions: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleForwardResponseStreamError(wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, err error) {
|
||||||
|
buf, merr := marshaler.Marshal(streamChunk(nil, err))
|
||||||
|
if merr != nil {
|
||||||
|
grpclog.Infof("Failed to marshal an error: %v", merr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !wroteHeader {
|
||||||
|
s, ok := status.FromError(err)
|
||||||
|
if !ok {
|
||||||
|
s = status.New(codes.Unknown, err.Error())
|
||||||
|
}
|
||||||
|
w.WriteHeader(HTTPStatusFromCode(s.Code()))
|
||||||
|
}
|
||||||
|
if _, werr := w.Write(buf); werr != nil {
|
||||||
|
grpclog.Infof("Failed to notify error to client: %v", werr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func streamChunk(result proto.Message, err error) map[string]proto.Message {
|
||||||
|
if err != nil {
|
||||||
|
grpcCode := codes.Unknown
|
||||||
|
grpcMessage := err.Error()
|
||||||
|
var grpcDetails []*any.Any
|
||||||
|
if s, ok := status.FromError(err); ok {
|
||||||
|
grpcCode = s.Code()
|
||||||
|
grpcMessage = s.Message()
|
||||||
|
grpcDetails = s.Proto().GetDetails()
|
||||||
|
}
|
||||||
|
httpCode := HTTPStatusFromCode(grpcCode)
|
||||||
|
return map[string]proto.Message{
|
||||||
|
"error": &internal.StreamError{
|
||||||
|
GrpcCode: int32(grpcCode),
|
||||||
|
HttpCode: int32(httpCode),
|
||||||
|
Message: grpcMessage,
|
||||||
|
HttpStatus: http.StatusText(httpCode),
|
||||||
|
Details: grpcDetails,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if result == nil {
|
||||||
|
return streamChunk(nil, fmt.Errorf("empty response"))
|
||||||
|
}
|
||||||
|
return map[string]proto.Message{"result": result}
|
||||||
|
}
|
45
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go
generated
vendored
Normal file
45
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
// JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON
|
||||||
|
// with the standard "encoding/json" package of Golang.
|
||||||
|
// Although it is generally faster for simple proto messages than JSONPb,
|
||||||
|
// it does not support advanced features of protobuf, e.g. map, oneof, ....
|
||||||
|
//
|
||||||
|
// The NewEncoder and NewDecoder types return *json.Encoder and
|
||||||
|
// *json.Decoder respectively.
|
||||||
|
type JSONBuiltin struct{}
|
||||||
|
|
||||||
|
// ContentType always Returns "application/json".
|
||||||
|
func (*JSONBuiltin) ContentType() string {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Marshal marshals "v" into JSON
|
||||||
|
func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) {
|
||||||
|
return json.Marshal(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unmarshal unmarshals JSON data into "v".
|
||||||
|
func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error {
|
||||||
|
return json.Unmarshal(data, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDecoder returns a Decoder which reads JSON stream from "r".
|
||||||
|
func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder {
|
||||||
|
return json.NewDecoder(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewEncoder returns an Encoder which writes JSON stream into "w".
|
||||||
|
func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder {
|
||||||
|
return json.NewEncoder(w)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delimiter for newline encoded JSON streams.
|
||||||
|
func (j *JSONBuiltin) Delimiter() []byte {
|
||||||
|
return []byte("\n")
|
||||||
|
}
|
242
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go
generated
vendored
Normal file
242
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go
generated
vendored
Normal file
|
@ -0,0 +1,242 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/jsonpb"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// JSONPb is a Marshaler which marshals/unmarshals into/from JSON
|
||||||
|
// with the "github.com/golang/protobuf/jsonpb".
|
||||||
|
// It supports fully functionality of protobuf unlike JSONBuiltin.
|
||||||
|
//
|
||||||
|
// The NewDecoder method returns a DecoderWrapper, so the underlying
|
||||||
|
// *json.Decoder methods can be used.
|
||||||
|
type JSONPb jsonpb.Marshaler
|
||||||
|
|
||||||
|
// ContentType always returns "application/json".
|
||||||
|
func (*JSONPb) ContentType() string {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Marshal marshals "v" into JSON.
|
||||||
|
func (j *JSONPb) Marshal(v interface{}) ([]byte, error) {
|
||||||
|
if _, ok := v.(proto.Message); !ok {
|
||||||
|
return j.marshalNonProtoField(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
if err := j.marshalTo(&buf, v); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return buf.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error {
|
||||||
|
p, ok := v.(proto.Message)
|
||||||
|
if !ok {
|
||||||
|
buf, err := j.marshalNonProtoField(v)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = w.Write(buf)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return (*jsonpb.Marshaler)(j).Marshal(w, p)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// protoMessageType is stored to prevent constant lookup of the same type at runtime.
|
||||||
|
protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem()
|
||||||
|
)
|
||||||
|
|
||||||
|
// marshalNonProto marshals a non-message field of a protobuf message.
|
||||||
|
// This function does not correctly marshals arbitrary data structure into JSON,
|
||||||
|
// but it is only capable of marshaling non-message field values of protobuf,
|
||||||
|
// i.e. primitive types, enums; pointers to primitives or enums; maps from
|
||||||
|
// integer/string types to primitives/enums/pointers to messages.
|
||||||
|
func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) {
|
||||||
|
if v == nil {
|
||||||
|
return []byte("null"), nil
|
||||||
|
}
|
||||||
|
rv := reflect.ValueOf(v)
|
||||||
|
for rv.Kind() == reflect.Ptr {
|
||||||
|
if rv.IsNil() {
|
||||||
|
return []byte("null"), nil
|
||||||
|
}
|
||||||
|
rv = rv.Elem()
|
||||||
|
}
|
||||||
|
|
||||||
|
if rv.Kind() == reflect.Slice {
|
||||||
|
if rv.IsNil() {
|
||||||
|
if j.EmitDefaults {
|
||||||
|
return []byte("[]"), nil
|
||||||
|
}
|
||||||
|
return []byte("null"), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if rv.Type().Elem().Implements(protoMessageType) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err := buf.WriteByte('[')
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for i := 0; i < rv.Len(); i++ {
|
||||||
|
if i != 0 {
|
||||||
|
err = buf.WriteByte(',')
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err = (*jsonpb.Marshaler)(j).Marshal(&buf, rv.Index(i).Interface().(proto.Message)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = buf.WriteByte(']')
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf.Bytes(), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rv.Kind() == reflect.Map {
|
||||||
|
m := make(map[string]*json.RawMessage)
|
||||||
|
for _, k := range rv.MapKeys() {
|
||||||
|
buf, err := j.Marshal(rv.MapIndex(k).Interface())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf)
|
||||||
|
}
|
||||||
|
if j.Indent != "" {
|
||||||
|
return json.MarshalIndent(m, "", j.Indent)
|
||||||
|
}
|
||||||
|
return json.Marshal(m)
|
||||||
|
}
|
||||||
|
if enum, ok := rv.Interface().(protoEnum); ok && !j.EnumsAsInts {
|
||||||
|
return json.Marshal(enum.String())
|
||||||
|
}
|
||||||
|
return json.Marshal(rv.Interface())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unmarshal unmarshals JSON "data" into "v"
|
||||||
|
func (j *JSONPb) Unmarshal(data []byte, v interface{}) error {
|
||||||
|
return unmarshalJSONPb(data, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDecoder returns a Decoder which reads JSON stream from "r".
|
||||||
|
func (j *JSONPb) NewDecoder(r io.Reader) Decoder {
|
||||||
|
d := json.NewDecoder(r)
|
||||||
|
return DecoderWrapper{Decoder: d}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecoderWrapper is a wrapper around a *json.Decoder that adds
|
||||||
|
// support for protos to the Decode method.
|
||||||
|
type DecoderWrapper struct {
|
||||||
|
*json.Decoder
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode wraps the embedded decoder's Decode method to support
|
||||||
|
// protos using a jsonpb.Unmarshaler.
|
||||||
|
func (d DecoderWrapper) Decode(v interface{}) error {
|
||||||
|
return decodeJSONPb(d.Decoder, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewEncoder returns an Encoder which writes JSON stream into "w".
|
||||||
|
func (j *JSONPb) NewEncoder(w io.Writer) Encoder {
|
||||||
|
return EncoderFunc(func(v interface{}) error { return j.marshalTo(w, v) })
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalJSONPb(data []byte, v interface{}) error {
|
||||||
|
d := json.NewDecoder(bytes.NewReader(data))
|
||||||
|
return decodeJSONPb(d, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeJSONPb(d *json.Decoder, v interface{}) error {
|
||||||
|
p, ok := v.(proto.Message)
|
||||||
|
if !ok {
|
||||||
|
return decodeNonProtoField(d, v)
|
||||||
|
}
|
||||||
|
unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true}
|
||||||
|
return unmarshaler.UnmarshalNext(d, p)
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeNonProtoField(d *json.Decoder, v interface{}) error {
|
||||||
|
rv := reflect.ValueOf(v)
|
||||||
|
if rv.Kind() != reflect.Ptr {
|
||||||
|
return fmt.Errorf("%T is not a pointer", v)
|
||||||
|
}
|
||||||
|
for rv.Kind() == reflect.Ptr {
|
||||||
|
if rv.IsNil() {
|
||||||
|
rv.Set(reflect.New(rv.Type().Elem()))
|
||||||
|
}
|
||||||
|
if rv.Type().ConvertibleTo(typeProtoMessage) {
|
||||||
|
unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true}
|
||||||
|
return unmarshaler.UnmarshalNext(d, rv.Interface().(proto.Message))
|
||||||
|
}
|
||||||
|
rv = rv.Elem()
|
||||||
|
}
|
||||||
|
if rv.Kind() == reflect.Map {
|
||||||
|
if rv.IsNil() {
|
||||||
|
rv.Set(reflect.MakeMap(rv.Type()))
|
||||||
|
}
|
||||||
|
conv, ok := convFromType[rv.Type().Key().Kind()]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unsupported type of map field key: %v", rv.Type().Key())
|
||||||
|
}
|
||||||
|
|
||||||
|
m := make(map[string]*json.RawMessage)
|
||||||
|
if err := d.Decode(&m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for k, v := range m {
|
||||||
|
result := conv.Call([]reflect.Value{reflect.ValueOf(k)})
|
||||||
|
if err := result[1].Interface(); err != nil {
|
||||||
|
return err.(error)
|
||||||
|
}
|
||||||
|
bk := result[0]
|
||||||
|
bv := reflect.New(rv.Type().Elem())
|
||||||
|
if err := unmarshalJSONPb([]byte(*v), bv.Interface()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rv.SetMapIndex(bk, bv.Elem())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if _, ok := rv.Interface().(protoEnum); ok {
|
||||||
|
var repr interface{}
|
||||||
|
if err := d.Decode(&repr); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
switch repr.(type) {
|
||||||
|
case string:
|
||||||
|
// TODO(yugui) Should use proto.StructProperties?
|
||||||
|
return fmt.Errorf("unmarshaling of symbolic enum %q not supported: %T", repr, rv.Interface())
|
||||||
|
case float64:
|
||||||
|
rv.Set(reflect.ValueOf(int32(repr.(float64))).Convert(rv.Type()))
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("cannot assign %#v into Go type %T", repr, rv.Interface())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return d.Decode(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
type protoEnum interface {
|
||||||
|
fmt.Stringer
|
||||||
|
EnumDescriptor() ([]byte, []int)
|
||||||
|
}
|
||||||
|
|
||||||
|
var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem()
|
||||||
|
|
||||||
|
// Delimiter for newline encoded JSON streams.
|
||||||
|
func (j *JSONPb) Delimiter() []byte {
|
||||||
|
return []byte("\n")
|
||||||
|
}
|
62
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto.go
generated
vendored
Normal file
62
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto.go
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"errors"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"io/ioutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProtoMarshaller is a Marshaller which marshals/unmarshals into/from serialize proto bytes
|
||||||
|
type ProtoMarshaller struct{}
|
||||||
|
|
||||||
|
// ContentType always returns "application/octet-stream".
|
||||||
|
func (*ProtoMarshaller) ContentType() string {
|
||||||
|
return "application/octet-stream"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Marshal marshals "value" into Proto
|
||||||
|
func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) {
|
||||||
|
message, ok := value.(proto.Message)
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("unable to marshal non proto field")
|
||||||
|
}
|
||||||
|
return proto.Marshal(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unmarshal unmarshals proto "data" into "value"
|
||||||
|
func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error {
|
||||||
|
message, ok := value.(proto.Message)
|
||||||
|
if !ok {
|
||||||
|
return errors.New("unable to unmarshal non proto field")
|
||||||
|
}
|
||||||
|
return proto.Unmarshal(data, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDecoder returns a Decoder which reads proto stream from "reader".
|
||||||
|
func (marshaller *ProtoMarshaller) NewDecoder(reader io.Reader) Decoder {
|
||||||
|
return DecoderFunc(func(value interface{}) error {
|
||||||
|
buffer, err := ioutil.ReadAll(reader)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return marshaller.Unmarshal(buffer, value)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewEncoder returns an Encoder which writes proto stream into "writer".
|
||||||
|
func (marshaller *ProtoMarshaller) NewEncoder(writer io.Writer) Encoder {
|
||||||
|
return EncoderFunc(func(value interface{}) error {
|
||||||
|
buffer, err := marshaller.Marshal(value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = writer.Write(buffer)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
48
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go
generated
vendored
Normal file
48
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Marshaler defines a conversion between byte sequence and gRPC payloads / fields.
|
||||||
|
type Marshaler interface {
|
||||||
|
// Marshal marshals "v" into byte sequence.
|
||||||
|
Marshal(v interface{}) ([]byte, error)
|
||||||
|
// Unmarshal unmarshals "data" into "v".
|
||||||
|
// "v" must be a pointer value.
|
||||||
|
Unmarshal(data []byte, v interface{}) error
|
||||||
|
// NewDecoder returns a Decoder which reads byte sequence from "r".
|
||||||
|
NewDecoder(r io.Reader) Decoder
|
||||||
|
// NewEncoder returns an Encoder which writes bytes sequence into "w".
|
||||||
|
NewEncoder(w io.Writer) Encoder
|
||||||
|
// ContentType returns the Content-Type which this marshaler is responsible for.
|
||||||
|
ContentType() string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decoder decodes a byte sequence
|
||||||
|
type Decoder interface {
|
||||||
|
Decode(v interface{}) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encoder encodes gRPC payloads / fields into byte sequence.
|
||||||
|
type Encoder interface {
|
||||||
|
Encode(v interface{}) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecoderFunc adapts an decoder function into Decoder.
|
||||||
|
type DecoderFunc func(v interface{}) error
|
||||||
|
|
||||||
|
// Decode delegates invocations to the underlying function itself.
|
||||||
|
func (f DecoderFunc) Decode(v interface{}) error { return f(v) }
|
||||||
|
|
||||||
|
// EncoderFunc adapts an encoder function into Encoder
|
||||||
|
type EncoderFunc func(v interface{}) error
|
||||||
|
|
||||||
|
// Encode delegates invocations to the underlying function itself.
|
||||||
|
func (f EncoderFunc) Encode(v interface{}) error { return f(v) }
|
||||||
|
|
||||||
|
// Delimited defines the streaming delimiter.
|
||||||
|
type Delimited interface {
|
||||||
|
// Delimiter returns the record seperator for the stream.
|
||||||
|
Delimiter() []byte
|
||||||
|
}
|
91
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go
generated
vendored
Normal file
91
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MIMEWildcard is the fallback MIME type used for requests which do not match
|
||||||
|
// a registered MIME type.
|
||||||
|
const MIMEWildcard = "*"
|
||||||
|
|
||||||
|
var (
|
||||||
|
acceptHeader = http.CanonicalHeaderKey("Accept")
|
||||||
|
contentTypeHeader = http.CanonicalHeaderKey("Content-Type")
|
||||||
|
|
||||||
|
defaultMarshaler = &JSONPb{OrigName: true}
|
||||||
|
)
|
||||||
|
|
||||||
|
// MarshalerForRequest returns the inbound/outbound marshalers for this request.
|
||||||
|
// It checks the registry on the ServeMux for the MIME type set by the Content-Type header.
|
||||||
|
// If it isn't set (or the request Content-Type is empty), checks for "*".
|
||||||
|
// If there are multiple Content-Type headers set, choose the first one that it can
|
||||||
|
// exactly match in the registry.
|
||||||
|
// Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler.
|
||||||
|
func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) {
|
||||||
|
for _, acceptVal := range r.Header[acceptHeader] {
|
||||||
|
if m, ok := mux.marshalers.mimeMap[acceptVal]; ok {
|
||||||
|
outbound = m
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, contentTypeVal := range r.Header[contentTypeHeader] {
|
||||||
|
if m, ok := mux.marshalers.mimeMap[contentTypeVal]; ok {
|
||||||
|
inbound = m
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if inbound == nil {
|
||||||
|
inbound = mux.marshalers.mimeMap[MIMEWildcard]
|
||||||
|
}
|
||||||
|
if outbound == nil {
|
||||||
|
outbound = inbound
|
||||||
|
}
|
||||||
|
|
||||||
|
return inbound, outbound
|
||||||
|
}
|
||||||
|
|
||||||
|
// marshalerRegistry is a mapping from MIME types to Marshalers.
|
||||||
|
type marshalerRegistry struct {
|
||||||
|
mimeMap map[string]Marshaler
|
||||||
|
}
|
||||||
|
|
||||||
|
// add adds a marshaler for a case-sensitive MIME type string ("*" to match any
|
||||||
|
// MIME type).
|
||||||
|
func (m marshalerRegistry) add(mime string, marshaler Marshaler) error {
|
||||||
|
if len(mime) == 0 {
|
||||||
|
return errors.New("empty MIME type")
|
||||||
|
}
|
||||||
|
|
||||||
|
m.mimeMap[mime] = marshaler
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// makeMarshalerMIMERegistry returns a new registry of marshalers.
|
||||||
|
// It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces.
|
||||||
|
//
|
||||||
|
// For example, you could allow the client to specify the use of the runtime.JSONPb marshaler
|
||||||
|
// with a "application/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler
|
||||||
|
// with a "application/json" Content-Type.
|
||||||
|
// "*" can be used to match any Content-Type.
|
||||||
|
// This can be attached to a ServerMux with the marshaler option.
|
||||||
|
func makeMarshalerMIMERegistry() marshalerRegistry {
|
||||||
|
return marshalerRegistry{
|
||||||
|
mimeMap: map[string]Marshaler{
|
||||||
|
MIMEWildcard: defaultMarshaler,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound
|
||||||
|
// Marshalers to a MIME type in mux.
|
||||||
|
func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption {
|
||||||
|
return func(mux *ServeMux) {
|
||||||
|
if err := mux.marshalers.add(mime, marshaler); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
268
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go
generated
vendored
Normal file
268
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go
generated
vendored
Normal file
|
@ -0,0 +1,268 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"net/textproto"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A HandlerFunc handles a specific pair of path pattern and HTTP method.
|
||||||
|
type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[string]string)
|
||||||
|
|
||||||
|
// ServeMux is a request multiplexer for grpc-gateway.
|
||||||
|
// It matches http requests to patterns and invokes the corresponding handler.
|
||||||
|
type ServeMux struct {
|
||||||
|
// handlers maps HTTP method to a list of handlers.
|
||||||
|
handlers map[string][]handler
|
||||||
|
forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error
|
||||||
|
marshalers marshalerRegistry
|
||||||
|
incomingHeaderMatcher HeaderMatcherFunc
|
||||||
|
outgoingHeaderMatcher HeaderMatcherFunc
|
||||||
|
metadataAnnotators []func(context.Context, *http.Request) metadata.MD
|
||||||
|
protoErrorHandler ProtoErrorHandlerFunc
|
||||||
|
disablePathLengthFallback bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServeMuxOption is an option that can be given to a ServeMux on construction.
|
||||||
|
type ServeMuxOption func(*ServeMux)
|
||||||
|
|
||||||
|
// WithForwardResponseOption returns a ServeMuxOption representing the forwardResponseOption.
|
||||||
|
//
|
||||||
|
// forwardResponseOption is an option that will be called on the relevant context.Context,
|
||||||
|
// http.ResponseWriter, and proto.Message before every forwarded response.
|
||||||
|
//
|
||||||
|
// The message may be nil in the case where just a header is being sent.
|
||||||
|
func WithForwardResponseOption(forwardResponseOption func(context.Context, http.ResponseWriter, proto.Message) error) ServeMuxOption {
|
||||||
|
return func(serveMux *ServeMux) {
|
||||||
|
serveMux.forwardResponseOptions = append(serveMux.forwardResponseOptions, forwardResponseOption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HeaderMatcherFunc checks whether a header key should be forwarded to/from gRPC context.
|
||||||
|
type HeaderMatcherFunc func(string) (string, bool)
|
||||||
|
|
||||||
|
// DefaultHeaderMatcher is used to pass http request headers to/from gRPC context. This adds permanent HTTP header
|
||||||
|
// keys (as specified by the IANA) to gRPC context with grpcgateway- prefix. HTTP headers that start with
|
||||||
|
// 'Grpc-Metadata-' are mapped to gRPC metadata after removing prefix 'Grpc-Metadata-'.
|
||||||
|
func DefaultHeaderMatcher(key string) (string, bool) {
|
||||||
|
key = textproto.CanonicalMIMEHeaderKey(key)
|
||||||
|
if isPermanentHTTPHeader(key) {
|
||||||
|
return MetadataPrefix + key, true
|
||||||
|
} else if strings.HasPrefix(key, MetadataHeaderPrefix) {
|
||||||
|
return key[len(MetadataHeaderPrefix):], true
|
||||||
|
}
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIncomingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for incoming request to gateway.
|
||||||
|
//
|
||||||
|
// This matcher will be called with each header in http.Request. If matcher returns true, that header will be
|
||||||
|
// passed to gRPC context. To transform the header before passing to gRPC context, matcher should return modified header.
|
||||||
|
func WithIncomingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption {
|
||||||
|
return func(mux *ServeMux) {
|
||||||
|
mux.incomingHeaderMatcher = fn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOutgoingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for outgoing response from gateway.
|
||||||
|
//
|
||||||
|
// This matcher will be called with each header in response header metadata. If matcher returns true, that header will be
|
||||||
|
// passed to http response returned from gateway. To transform the header before passing to response,
|
||||||
|
// matcher should return modified header.
|
||||||
|
func WithOutgoingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption {
|
||||||
|
return func(mux *ServeMux) {
|
||||||
|
mux.outgoingHeaderMatcher = fn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithMetadata returns a ServeMuxOption for passing metadata to a gRPC context.
|
||||||
|
//
|
||||||
|
// This can be used by services that need to read from http.Request and modify gRPC context. A common use case
|
||||||
|
// is reading token from cookie and adding it in gRPC context.
|
||||||
|
func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) ServeMuxOption {
|
||||||
|
return func(serveMux *ServeMux) {
|
||||||
|
serveMux.metadataAnnotators = append(serveMux.metadataAnnotators, annotator)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithProtoErrorHandler returns a ServeMuxOption for passing metadata to a gRPC context.
|
||||||
|
//
|
||||||
|
// This can be used to handle an error as general proto message defined by gRPC.
|
||||||
|
// The response including body and status is not backward compatible with the default error handler.
|
||||||
|
// When this option is used, HTTPError and OtherErrorHandler are overwritten on initialization.
|
||||||
|
func WithProtoErrorHandler(fn ProtoErrorHandlerFunc) ServeMuxOption {
|
||||||
|
return func(serveMux *ServeMux) {
|
||||||
|
serveMux.protoErrorHandler = fn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDisablePathLengthFallback returns a ServeMuxOption for disable path length fallback.
|
||||||
|
func WithDisablePathLengthFallback() ServeMuxOption {
|
||||||
|
return func(serveMux *ServeMux) {
|
||||||
|
serveMux.disablePathLengthFallback = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewServeMux returns a new ServeMux whose internal mapping is empty.
|
||||||
|
func NewServeMux(opts ...ServeMuxOption) *ServeMux {
|
||||||
|
serveMux := &ServeMux{
|
||||||
|
handlers: make(map[string][]handler),
|
||||||
|
forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0),
|
||||||
|
marshalers: makeMarshalerMIMERegistry(),
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(serveMux)
|
||||||
|
}
|
||||||
|
|
||||||
|
if serveMux.protoErrorHandler != nil {
|
||||||
|
HTTPError = serveMux.protoErrorHandler
|
||||||
|
// OtherErrorHandler is no longer used when protoErrorHandler is set.
|
||||||
|
// Overwritten by a special error handler to return Unknown.
|
||||||
|
OtherErrorHandler = func(w http.ResponseWriter, r *http.Request, _ string, _ int) {
|
||||||
|
ctx := context.Background()
|
||||||
|
_, outboundMarshaler := MarshalerForRequest(serveMux, r)
|
||||||
|
sterr := status.Error(codes.Unknown, "unexpected use of OtherErrorHandler")
|
||||||
|
serveMux.protoErrorHandler(ctx, serveMux, outboundMarshaler, w, r, sterr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if serveMux.incomingHeaderMatcher == nil {
|
||||||
|
serveMux.incomingHeaderMatcher = DefaultHeaderMatcher
|
||||||
|
}
|
||||||
|
|
||||||
|
if serveMux.outgoingHeaderMatcher == nil {
|
||||||
|
serveMux.outgoingHeaderMatcher = func(key string) (string, bool) {
|
||||||
|
return fmt.Sprintf("%s%s", MetadataHeaderPrefix, key), true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return serveMux
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle associates "h" to the pair of HTTP method and path pattern.
|
||||||
|
func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) {
|
||||||
|
s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path.
|
||||||
|
func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
ctx := r.Context()
|
||||||
|
|
||||||
|
path := r.URL.Path
|
||||||
|
if !strings.HasPrefix(path, "/") {
|
||||||
|
if s.protoErrorHandler != nil {
|
||||||
|
_, outboundMarshaler := MarshalerForRequest(s, r)
|
||||||
|
sterr := status.Error(codes.InvalidArgument, http.StatusText(http.StatusBadRequest))
|
||||||
|
s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr)
|
||||||
|
} else {
|
||||||
|
OtherErrorHandler(w, r, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
components := strings.Split(path[1:], "/")
|
||||||
|
l := len(components)
|
||||||
|
var verb string
|
||||||
|
if idx := strings.LastIndex(components[l-1], ":"); idx == 0 {
|
||||||
|
if s.protoErrorHandler != nil {
|
||||||
|
_, outboundMarshaler := MarshalerForRequest(s, r)
|
||||||
|
sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented))
|
||||||
|
s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr)
|
||||||
|
} else {
|
||||||
|
OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
} else if idx > 0 {
|
||||||
|
c := components[l-1]
|
||||||
|
components[l-1], verb = c[:idx], c[idx+1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && s.isPathLengthFallback(r) {
|
||||||
|
r.Method = strings.ToUpper(override)
|
||||||
|
if err := r.ParseForm(); err != nil {
|
||||||
|
if s.protoErrorHandler != nil {
|
||||||
|
_, outboundMarshaler := MarshalerForRequest(s, r)
|
||||||
|
sterr := status.Error(codes.InvalidArgument, err.Error())
|
||||||
|
s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr)
|
||||||
|
} else {
|
||||||
|
OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, h := range s.handlers[r.Method] {
|
||||||
|
pathParams, err := h.pat.Match(components, verb)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
h.h(w, r, pathParams)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// lookup other methods to handle fallback from GET to POST and
|
||||||
|
// to determine if it is MethodNotAllowed or NotFound.
|
||||||
|
for m, handlers := range s.handlers {
|
||||||
|
if m == r.Method {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, h := range handlers {
|
||||||
|
pathParams, err := h.pat.Match(components, verb)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// X-HTTP-Method-Override is optional. Always allow fallback to POST.
|
||||||
|
if s.isPathLengthFallback(r) {
|
||||||
|
if err := r.ParseForm(); err != nil {
|
||||||
|
if s.protoErrorHandler != nil {
|
||||||
|
_, outboundMarshaler := MarshalerForRequest(s, r)
|
||||||
|
sterr := status.Error(codes.InvalidArgument, err.Error())
|
||||||
|
s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr)
|
||||||
|
} else {
|
||||||
|
OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
h.h(w, r, pathParams)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.protoErrorHandler != nil {
|
||||||
|
_, outboundMarshaler := MarshalerForRequest(s, r)
|
||||||
|
sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusMethodNotAllowed))
|
||||||
|
s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr)
|
||||||
|
} else {
|
||||||
|
OtherErrorHandler(w, r, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.protoErrorHandler != nil {
|
||||||
|
_, outboundMarshaler := MarshalerForRequest(s, r)
|
||||||
|
sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented))
|
||||||
|
s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr)
|
||||||
|
} else {
|
||||||
|
OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetForwardResponseOptions returns the ForwardResponseOptions associated with this ServeMux.
|
||||||
|
func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.ResponseWriter, proto.Message) error {
|
||||||
|
return s.forwardResponseOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ServeMux) isPathLengthFallback(r *http.Request) bool {
|
||||||
|
return !s.disablePathLengthFallback && r.Method == "POST" && r.Header.Get("Content-Type") == "application/x-www-form-urlencoded"
|
||||||
|
}
|
||||||
|
|
||||||
|
type handler struct {
|
||||||
|
pat Pattern
|
||||||
|
h HandlerFunc
|
||||||
|
}
|
227
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go
generated
vendored
Normal file
227
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go
generated
vendored
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ErrNotMatch indicates that the given HTTP request path does not match to the pattern.
|
||||||
|
ErrNotMatch = errors.New("not match to the path pattern")
|
||||||
|
// ErrInvalidPattern indicates that the given definition of Pattern is not valid.
|
||||||
|
ErrInvalidPattern = errors.New("invalid pattern")
|
||||||
|
)
|
||||||
|
|
||||||
|
type op struct {
|
||||||
|
code utilities.OpCode
|
||||||
|
operand int
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pattern is a template pattern of http request paths defined in github.com/googleapis/googleapis/google/api/http.proto.
|
||||||
|
type Pattern struct {
|
||||||
|
// ops is a list of operations
|
||||||
|
ops []op
|
||||||
|
// pool is a constant pool indexed by the operands or vars.
|
||||||
|
pool []string
|
||||||
|
// vars is a list of variables names to be bound by this pattern
|
||||||
|
vars []string
|
||||||
|
// stacksize is the max depth of the stack
|
||||||
|
stacksize int
|
||||||
|
// tailLen is the length of the fixed-size segments after a deep wildcard
|
||||||
|
tailLen int
|
||||||
|
// verb is the VERB part of the path pattern. It is empty if the pattern does not have VERB part.
|
||||||
|
verb string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPattern returns a new Pattern from the given definition values.
|
||||||
|
// "ops" is a sequence of op codes. "pool" is a constant pool.
|
||||||
|
// "verb" is the verb part of the pattern. It is empty if the pattern does not have the part.
|
||||||
|
// "version" must be 1 for now.
|
||||||
|
// It returns an error if the given definition is invalid.
|
||||||
|
func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) {
|
||||||
|
if version != 1 {
|
||||||
|
grpclog.Infof("unsupported version: %d", version)
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
|
||||||
|
l := len(ops)
|
||||||
|
if l%2 != 0 {
|
||||||
|
grpclog.Infof("odd number of ops codes: %d", l)
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
typedOps []op
|
||||||
|
stack, maxstack int
|
||||||
|
tailLen int
|
||||||
|
pushMSeen bool
|
||||||
|
vars []string
|
||||||
|
)
|
||||||
|
for i := 0; i < l; i += 2 {
|
||||||
|
op := op{code: utilities.OpCode(ops[i]), operand: ops[i+1]}
|
||||||
|
switch op.code {
|
||||||
|
case utilities.OpNop:
|
||||||
|
continue
|
||||||
|
case utilities.OpPush:
|
||||||
|
if pushMSeen {
|
||||||
|
tailLen++
|
||||||
|
}
|
||||||
|
stack++
|
||||||
|
case utilities.OpPushM:
|
||||||
|
if pushMSeen {
|
||||||
|
grpclog.Infof("pushM appears twice")
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
pushMSeen = true
|
||||||
|
stack++
|
||||||
|
case utilities.OpLitPush:
|
||||||
|
if op.operand < 0 || len(pool) <= op.operand {
|
||||||
|
grpclog.Infof("negative literal index: %d", op.operand)
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
if pushMSeen {
|
||||||
|
tailLen++
|
||||||
|
}
|
||||||
|
stack++
|
||||||
|
case utilities.OpConcatN:
|
||||||
|
if op.operand <= 0 {
|
||||||
|
grpclog.Infof("negative concat size: %d", op.operand)
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
stack -= op.operand
|
||||||
|
if stack < 0 {
|
||||||
|
grpclog.Print("stack underflow")
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
stack++
|
||||||
|
case utilities.OpCapture:
|
||||||
|
if op.operand < 0 || len(pool) <= op.operand {
|
||||||
|
grpclog.Infof("variable name index out of bound: %d", op.operand)
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
v := pool[op.operand]
|
||||||
|
op.operand = len(vars)
|
||||||
|
vars = append(vars, v)
|
||||||
|
stack--
|
||||||
|
if stack < 0 {
|
||||||
|
grpclog.Infof("stack underflow")
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
grpclog.Infof("invalid opcode: %d", op.code)
|
||||||
|
return Pattern{}, ErrInvalidPattern
|
||||||
|
}
|
||||||
|
|
||||||
|
if maxstack < stack {
|
||||||
|
maxstack = stack
|
||||||
|
}
|
||||||
|
typedOps = append(typedOps, op)
|
||||||
|
}
|
||||||
|
return Pattern{
|
||||||
|
ops: typedOps,
|
||||||
|
pool: pool,
|
||||||
|
vars: vars,
|
||||||
|
stacksize: maxstack,
|
||||||
|
tailLen: tailLen,
|
||||||
|
verb: verb,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MustPattern is a helper function which makes it easier to call NewPattern in variable initialization.
|
||||||
|
func MustPattern(p Pattern, err error) Pattern {
|
||||||
|
if err != nil {
|
||||||
|
grpclog.Fatalf("Pattern initialization failed: %v", err)
|
||||||
|
}
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match examines components if it matches to the Pattern.
|
||||||
|
// If it matches, the function returns a mapping from field paths to their captured values.
|
||||||
|
// If otherwise, the function returns an error.
|
||||||
|
func (p Pattern) Match(components []string, verb string) (map[string]string, error) {
|
||||||
|
if p.verb != verb {
|
||||||
|
return nil, ErrNotMatch
|
||||||
|
}
|
||||||
|
|
||||||
|
var pos int
|
||||||
|
stack := make([]string, 0, p.stacksize)
|
||||||
|
captured := make([]string, len(p.vars))
|
||||||
|
l := len(components)
|
||||||
|
for _, op := range p.ops {
|
||||||
|
switch op.code {
|
||||||
|
case utilities.OpNop:
|
||||||
|
continue
|
||||||
|
case utilities.OpPush, utilities.OpLitPush:
|
||||||
|
if pos >= l {
|
||||||
|
return nil, ErrNotMatch
|
||||||
|
}
|
||||||
|
c := components[pos]
|
||||||
|
if op.code == utilities.OpLitPush {
|
||||||
|
if lit := p.pool[op.operand]; c != lit {
|
||||||
|
return nil, ErrNotMatch
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stack = append(stack, c)
|
||||||
|
pos++
|
||||||
|
case utilities.OpPushM:
|
||||||
|
end := len(components)
|
||||||
|
if end < pos+p.tailLen {
|
||||||
|
return nil, ErrNotMatch
|
||||||
|
}
|
||||||
|
end -= p.tailLen
|
||||||
|
stack = append(stack, strings.Join(components[pos:end], "/"))
|
||||||
|
pos = end
|
||||||
|
case utilities.OpConcatN:
|
||||||
|
n := op.operand
|
||||||
|
l := len(stack) - n
|
||||||
|
stack = append(stack[:l], strings.Join(stack[l:], "/"))
|
||||||
|
case utilities.OpCapture:
|
||||||
|
n := len(stack) - 1
|
||||||
|
captured[op.operand] = stack[n]
|
||||||
|
stack = stack[:n]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if pos < l {
|
||||||
|
return nil, ErrNotMatch
|
||||||
|
}
|
||||||
|
bindings := make(map[string]string)
|
||||||
|
for i, val := range captured {
|
||||||
|
bindings[p.vars[i]] = val
|
||||||
|
}
|
||||||
|
return bindings, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verb returns the verb part of the Pattern.
|
||||||
|
func (p Pattern) Verb() string { return p.verb }
|
||||||
|
|
||||||
|
func (p Pattern) String() string {
|
||||||
|
var stack []string
|
||||||
|
for _, op := range p.ops {
|
||||||
|
switch op.code {
|
||||||
|
case utilities.OpNop:
|
||||||
|
continue
|
||||||
|
case utilities.OpPush:
|
||||||
|
stack = append(stack, "*")
|
||||||
|
case utilities.OpLitPush:
|
||||||
|
stack = append(stack, p.pool[op.operand])
|
||||||
|
case utilities.OpPushM:
|
||||||
|
stack = append(stack, "**")
|
||||||
|
case utilities.OpConcatN:
|
||||||
|
n := op.operand
|
||||||
|
l := len(stack) - n
|
||||||
|
stack = append(stack[:l], strings.Join(stack[l:], "/"))
|
||||||
|
case utilities.OpCapture:
|
||||||
|
n := len(stack) - 1
|
||||||
|
stack[n] = fmt.Sprintf("{%s=%s}", p.vars[op.operand], stack[n])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
segs := strings.Join(stack, "/")
|
||||||
|
if p.verb != "" {
|
||||||
|
return fmt.Sprintf("/%s:%s", segs, p.verb)
|
||||||
|
}
|
||||||
|
return "/" + segs
|
||||||
|
}
|
80
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go
generated
vendored
Normal file
80
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// StringP returns a pointer to a string whose pointee is same as the given string value.
|
||||||
|
func StringP(val string) (*string, error) {
|
||||||
|
return proto.String(val), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolP parses the given string representation of a boolean value,
|
||||||
|
// and returns a pointer to a bool whose value is same as the parsed value.
|
||||||
|
func BoolP(val string) (*bool, error) {
|
||||||
|
b, err := Bool(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return proto.Bool(b), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float64P parses the given string representation of a floating point number,
|
||||||
|
// and returns a pointer to a float64 whose value is same as the parsed number.
|
||||||
|
func Float64P(val string) (*float64, error) {
|
||||||
|
f, err := Float64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return proto.Float64(f), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float32P parses the given string representation of a floating point number,
|
||||||
|
// and returns a pointer to a float32 whose value is same as the parsed number.
|
||||||
|
func Float32P(val string) (*float32, error) {
|
||||||
|
f, err := Float32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return proto.Float32(f), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64P parses the given string representation of an integer
|
||||||
|
// and returns a pointer to a int64 whose value is same as the parsed integer.
|
||||||
|
func Int64P(val string) (*int64, error) {
|
||||||
|
i, err := Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return proto.Int64(i), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int32P parses the given string representation of an integer
|
||||||
|
// and returns a pointer to a int32 whose value is same as the parsed integer.
|
||||||
|
func Int32P(val string) (*int32, error) {
|
||||||
|
i, err := Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return proto.Int32(i), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint64P parses the given string representation of an integer
|
||||||
|
// and returns a pointer to a uint64 whose value is same as the parsed integer.
|
||||||
|
func Uint64P(val string) (*uint64, error) {
|
||||||
|
i, err := Uint64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return proto.Uint64(i), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint32P parses the given string representation of an integer
|
||||||
|
// and returns a pointer to a uint32 whose value is same as the parsed integer.
|
||||||
|
func Uint32P(val string) (*uint32, error) {
|
||||||
|
i, err := Uint32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return proto.Uint32(i), err
|
||||||
|
}
|
61
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto_errors.go
generated
vendored
Normal file
61
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto_errors.go
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"context"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProtoErrorHandlerFunc handles the error as a gRPC error generated via status package and replies to the request.
|
||||||
|
type ProtoErrorHandlerFunc func(context.Context, *ServeMux, Marshaler, http.ResponseWriter, *http.Request, error)
|
||||||
|
|
||||||
|
var _ ProtoErrorHandlerFunc = DefaultHTTPProtoErrorHandler
|
||||||
|
|
||||||
|
// DefaultHTTPProtoErrorHandler is an implementation of HTTPError.
|
||||||
|
// If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode.
|
||||||
|
// If otherwise, it replies with http.StatusInternalServerError.
|
||||||
|
//
|
||||||
|
// The response body returned by this function is a Status message marshaled by a Marshaler.
|
||||||
|
//
|
||||||
|
// Do not set this function to HTTPError variable directly, use WithProtoErrorHandler option instead.
|
||||||
|
func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) {
|
||||||
|
// return Internal when Marshal failed
|
||||||
|
const fallback = `{"code": 13, "message": "failed to marshal error message"}`
|
||||||
|
|
||||||
|
w.Header().Del("Trailer")
|
||||||
|
w.Header().Set("Content-Type", marshaler.ContentType())
|
||||||
|
|
||||||
|
s, ok := status.FromError(err)
|
||||||
|
if !ok {
|
||||||
|
s = status.New(codes.Unknown, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
buf, merr := marshaler.Marshal(s.Proto())
|
||||||
|
if merr != nil {
|
||||||
|
grpclog.Infof("Failed to marshal error message %q: %v", s.Proto(), merr)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
if _, err := io.WriteString(w, fallback); err != nil {
|
||||||
|
grpclog.Infof("Failed to write response: %v", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
md, ok := ServerMetadataFromContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
grpclog.Infof("Failed to extract ServerMetadata from context")
|
||||||
|
}
|
||||||
|
|
||||||
|
handleForwardResponseServerMetadata(w, mux, md)
|
||||||
|
handleForwardResponseTrailerHeader(w, md)
|
||||||
|
st := HTTPStatusFromCode(s.Code())
|
||||||
|
w.WriteHeader(st)
|
||||||
|
if _, err := w.Write(buf); err != nil {
|
||||||
|
grpclog.Infof("Failed to write response: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleForwardResponseTrailer(w, md)
|
||||||
|
}
|
392
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go
generated
vendored
Normal file
392
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go
generated
vendored
Normal file
|
@ -0,0 +1,392 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"reflect"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PopulateQueryParameters populates "values" into "msg".
|
||||||
|
// A value is ignored if its key starts with one of the elements in "filter".
|
||||||
|
func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error {
|
||||||
|
for key, values := range values {
|
||||||
|
re, err := regexp.Compile("^(.*)\\[(.*)\\]$")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
match := re.FindStringSubmatch(key)
|
||||||
|
if len(match) == 3 {
|
||||||
|
key = match[1]
|
||||||
|
values = append([]string{match[2]}, values...)
|
||||||
|
}
|
||||||
|
fieldPath := strings.Split(key, ".")
|
||||||
|
if filter.HasCommonPrefix(fieldPath) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err := populateFieldValueFromPath(msg, fieldPath, values); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PopulateFieldFromPath sets a value in a nested Protobuf structure.
|
||||||
|
// It instantiates missing protobuf fields as it goes.
|
||||||
|
func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error {
|
||||||
|
fieldPath := strings.Split(fieldPathString, ".")
|
||||||
|
return populateFieldValueFromPath(msg, fieldPath, []string{value})
|
||||||
|
}
|
||||||
|
|
||||||
|
func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values []string) error {
|
||||||
|
m := reflect.ValueOf(msg)
|
||||||
|
if m.Kind() != reflect.Ptr {
|
||||||
|
return fmt.Errorf("unexpected type %T: %v", msg, msg)
|
||||||
|
}
|
||||||
|
var props *proto.Properties
|
||||||
|
m = m.Elem()
|
||||||
|
for i, fieldName := range fieldPath {
|
||||||
|
isLast := i == len(fieldPath)-1
|
||||||
|
if !isLast && m.Kind() != reflect.Struct {
|
||||||
|
return fmt.Errorf("non-aggregate type in the mid of path: %s", strings.Join(fieldPath, "."))
|
||||||
|
}
|
||||||
|
var f reflect.Value
|
||||||
|
var err error
|
||||||
|
f, props, err = fieldByProtoName(m, fieldName)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !f.IsValid() {
|
||||||
|
grpclog.Infof("field not found in %T: %s", msg, strings.Join(fieldPath, "."))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch f.Kind() {
|
||||||
|
case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.String, reflect.Uint32, reflect.Uint64:
|
||||||
|
if !isLast {
|
||||||
|
return fmt.Errorf("unexpected nested field %s in %s", fieldPath[i+1], strings.Join(fieldPath[:i+1], "."))
|
||||||
|
}
|
||||||
|
m = f
|
||||||
|
case reflect.Slice:
|
||||||
|
if !isLast {
|
||||||
|
return fmt.Errorf("unexpected repeated field in %s", strings.Join(fieldPath, "."))
|
||||||
|
}
|
||||||
|
// Handle []byte
|
||||||
|
if f.Type().Elem().Kind() == reflect.Uint8 {
|
||||||
|
m = f
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return populateRepeatedField(f, values, props)
|
||||||
|
case reflect.Ptr:
|
||||||
|
if f.IsNil() {
|
||||||
|
m = reflect.New(f.Type().Elem())
|
||||||
|
f.Set(m.Convert(f.Type()))
|
||||||
|
}
|
||||||
|
m = f.Elem()
|
||||||
|
continue
|
||||||
|
case reflect.Struct:
|
||||||
|
m = f
|
||||||
|
continue
|
||||||
|
case reflect.Map:
|
||||||
|
if !isLast {
|
||||||
|
return fmt.Errorf("unexpected nested field %s in %s", fieldPath[i+1], strings.Join(fieldPath[:i+1], "."))
|
||||||
|
}
|
||||||
|
return populateMapField(f, values, props)
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unexpected type %s in %T", f.Type(), msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch len(values) {
|
||||||
|
case 0:
|
||||||
|
return fmt.Errorf("no value of field: %s", strings.Join(fieldPath, "."))
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
grpclog.Infof("too many field values: %s", strings.Join(fieldPath, "."))
|
||||||
|
}
|
||||||
|
return populateField(m, values[0], props)
|
||||||
|
}
|
||||||
|
|
||||||
|
// fieldByProtoName looks up a field whose corresponding protobuf field name is "name".
|
||||||
|
// "m" must be a struct value. It returns zero reflect.Value if no such field found.
|
||||||
|
func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties, error) {
|
||||||
|
props := proto.GetProperties(m.Type())
|
||||||
|
|
||||||
|
// look up field name in oneof map
|
||||||
|
if op, ok := props.OneofTypes[name]; ok {
|
||||||
|
v := reflect.New(op.Type.Elem())
|
||||||
|
field := m.Field(op.Field)
|
||||||
|
if !field.IsNil() {
|
||||||
|
return reflect.Value{}, nil, fmt.Errorf("field already set for %s oneof", props.Prop[op.Field].OrigName)
|
||||||
|
}
|
||||||
|
field.Set(v)
|
||||||
|
return v.Elem().Field(0), op.Prop, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, p := range props.Prop {
|
||||||
|
if p.OrigName == name {
|
||||||
|
return m.FieldByName(p.Name), p, nil
|
||||||
|
}
|
||||||
|
if p.JSONName == name {
|
||||||
|
return m.FieldByName(p.Name), p, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return reflect.Value{}, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func populateMapField(f reflect.Value, values []string, props *proto.Properties) error {
|
||||||
|
if len(values) != 2 {
|
||||||
|
return fmt.Errorf("more than one value provided for key %s in map %s", values[0], props.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
key, value := values[0], values[1]
|
||||||
|
keyType := f.Type().Key()
|
||||||
|
valueType := f.Type().Elem()
|
||||||
|
if f.IsNil() {
|
||||||
|
f.Set(reflect.MakeMap(f.Type()))
|
||||||
|
}
|
||||||
|
|
||||||
|
keyConv, ok := convFromType[keyType.Kind()]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unsupported key type %s in map %s", keyType, props.Name)
|
||||||
|
}
|
||||||
|
valueConv, ok := convFromType[valueType.Kind()]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unsupported value type %s in map %s", valueType, props.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
keyV := keyConv.Call([]reflect.Value{reflect.ValueOf(key)})
|
||||||
|
if err := keyV[1].Interface(); err != nil {
|
||||||
|
return err.(error)
|
||||||
|
}
|
||||||
|
valueV := valueConv.Call([]reflect.Value{reflect.ValueOf(value)})
|
||||||
|
if err := valueV[1].Interface(); err != nil {
|
||||||
|
return err.(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
f.SetMapIndex(keyV[0].Convert(keyType), valueV[0].Convert(valueType))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func populateRepeatedField(f reflect.Value, values []string, props *proto.Properties) error {
|
||||||
|
elemType := f.Type().Elem()
|
||||||
|
|
||||||
|
// is the destination field a slice of an enumeration type?
|
||||||
|
if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil {
|
||||||
|
return populateFieldEnumRepeated(f, values, enumValMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
conv, ok := convFromType[elemType.Kind()]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unsupported field type %s", elemType)
|
||||||
|
}
|
||||||
|
f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type()))
|
||||||
|
for i, v := range values {
|
||||||
|
result := conv.Call([]reflect.Value{reflect.ValueOf(v)})
|
||||||
|
if err := result[1].Interface(); err != nil {
|
||||||
|
return err.(error)
|
||||||
|
}
|
||||||
|
f.Index(i).Set(result[0].Convert(f.Index(i).Type()))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func populateField(f reflect.Value, value string, props *proto.Properties) error {
|
||||||
|
i := f.Addr().Interface()
|
||||||
|
|
||||||
|
// Handle protobuf well known types
|
||||||
|
type wkt interface {
|
||||||
|
XXX_WellKnownType() string
|
||||||
|
}
|
||||||
|
if wkt, ok := i.(wkt); ok {
|
||||||
|
switch wkt.XXX_WellKnownType() {
|
||||||
|
case "Timestamp":
|
||||||
|
if value == "null" {
|
||||||
|
f.Field(0).SetInt(0)
|
||||||
|
f.Field(1).SetInt(0)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
t, err := time.Parse(time.RFC3339Nano, value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad Timestamp: %v", err)
|
||||||
|
}
|
||||||
|
f.Field(0).SetInt(int64(t.Unix()))
|
||||||
|
f.Field(1).SetInt(int64(t.Nanosecond()))
|
||||||
|
return nil
|
||||||
|
case "Duration":
|
||||||
|
if value == "null" {
|
||||||
|
f.Field(0).SetInt(0)
|
||||||
|
f.Field(1).SetInt(0)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
d, err := time.ParseDuration(value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad Duration: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ns := d.Nanoseconds()
|
||||||
|
s := ns / 1e9
|
||||||
|
ns %= 1e9
|
||||||
|
f.Field(0).SetInt(s)
|
||||||
|
f.Field(1).SetInt(ns)
|
||||||
|
return nil
|
||||||
|
case "DoubleValue":
|
||||||
|
fallthrough
|
||||||
|
case "FloatValue":
|
||||||
|
float64Val, err := strconv.ParseFloat(value, 64)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad DoubleValue: %s", value)
|
||||||
|
}
|
||||||
|
f.Field(0).SetFloat(float64Val)
|
||||||
|
return nil
|
||||||
|
case "Int64Value":
|
||||||
|
fallthrough
|
||||||
|
case "Int32Value":
|
||||||
|
int64Val, err := strconv.ParseInt(value, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad DoubleValue: %s", value)
|
||||||
|
}
|
||||||
|
f.Field(0).SetInt(int64Val)
|
||||||
|
return nil
|
||||||
|
case "UInt64Value":
|
||||||
|
fallthrough
|
||||||
|
case "UInt32Value":
|
||||||
|
uint64Val, err := strconv.ParseUint(value, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad DoubleValue: %s", value)
|
||||||
|
}
|
||||||
|
f.Field(0).SetUint(uint64Val)
|
||||||
|
return nil
|
||||||
|
case "BoolValue":
|
||||||
|
if value == "true" {
|
||||||
|
f.Field(0).SetBool(true)
|
||||||
|
} else if value == "false" {
|
||||||
|
f.Field(0).SetBool(false)
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("bad BoolValue: %s", value)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
case "StringValue":
|
||||||
|
f.Field(0).SetString(value)
|
||||||
|
return nil
|
||||||
|
case "BytesValue":
|
||||||
|
bytesVal, err := base64.StdEncoding.DecodeString(value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad BytesValue: %s", value)
|
||||||
|
}
|
||||||
|
f.Field(0).SetBytes(bytesVal)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle google well known types
|
||||||
|
if gwkt, ok := i.(proto.Message); ok {
|
||||||
|
switch proto.MessageName(gwkt) {
|
||||||
|
case "google.protobuf.FieldMask":
|
||||||
|
p := f.Field(0)
|
||||||
|
for _, v := range strings.Split(value, ",") {
|
||||||
|
if v != "" {
|
||||||
|
p.Set(reflect.Append(p, reflect.ValueOf(v)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Time and Duration stdlib types
|
||||||
|
switch t := i.(type) {
|
||||||
|
case *time.Time:
|
||||||
|
pt, err := time.Parse(time.RFC3339Nano, value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad Timestamp: %v", err)
|
||||||
|
}
|
||||||
|
*t = pt
|
||||||
|
return nil
|
||||||
|
case *time.Duration:
|
||||||
|
d, err := time.ParseDuration(value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("bad Duration: %v", err)
|
||||||
|
}
|
||||||
|
*t = d
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// is the destination field an enumeration type?
|
||||||
|
if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil {
|
||||||
|
return populateFieldEnum(f, value, enumValMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
conv, ok := convFromType[f.Kind()]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("field type %T is not supported in query parameters", i)
|
||||||
|
}
|
||||||
|
result := conv.Call([]reflect.Value{reflect.ValueOf(value)})
|
||||||
|
if err := result[1].Interface(); err != nil {
|
||||||
|
return err.(error)
|
||||||
|
}
|
||||||
|
f.Set(result[0].Convert(f.Type()))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertEnum(value string, t reflect.Type, enumValMap map[string]int32) (reflect.Value, error) {
|
||||||
|
// see if it's an enumeration string
|
||||||
|
if enumVal, ok := enumValMap[value]; ok {
|
||||||
|
return reflect.ValueOf(enumVal).Convert(t), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for an integer that matches an enumeration value
|
||||||
|
eVal, err := strconv.Atoi(value)
|
||||||
|
if err != nil {
|
||||||
|
return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t)
|
||||||
|
}
|
||||||
|
for _, v := range enumValMap {
|
||||||
|
if v == int32(eVal) {
|
||||||
|
return reflect.ValueOf(eVal).Convert(t), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t)
|
||||||
|
}
|
||||||
|
|
||||||
|
func populateFieldEnum(f reflect.Value, value string, enumValMap map[string]int32) error {
|
||||||
|
cval, err := convertEnum(value, f.Type(), enumValMap)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
f.Set(cval)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func populateFieldEnumRepeated(f reflect.Value, values []string, enumValMap map[string]int32) error {
|
||||||
|
elemType := f.Type().Elem()
|
||||||
|
f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type()))
|
||||||
|
for i, v := range values {
|
||||||
|
result, err := convertEnum(v, elemType, enumValMap)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
f.Index(i).Set(result)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
convFromType = map[reflect.Kind]reflect.Value{
|
||||||
|
reflect.String: reflect.ValueOf(String),
|
||||||
|
reflect.Bool: reflect.ValueOf(Bool),
|
||||||
|
reflect.Float64: reflect.ValueOf(Float64),
|
||||||
|
reflect.Float32: reflect.ValueOf(Float32),
|
||||||
|
reflect.Int64: reflect.ValueOf(Int64),
|
||||||
|
reflect.Int32: reflect.ValueOf(Int32),
|
||||||
|
reflect.Uint64: reflect.ValueOf(Uint64),
|
||||||
|
reflect.Uint32: reflect.ValueOf(Uint32),
|
||||||
|
reflect.Slice: reflect.ValueOf(Bytes),
|
||||||
|
}
|
||||||
|
)
|
21
vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel
generated
vendored
Normal file
21
vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
||||||
|
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = [
|
||||||
|
"doc.go",
|
||||||
|
"pattern.go",
|
||||||
|
"readerfactory.go",
|
||||||
|
"trie.go",
|
||||||
|
],
|
||||||
|
importpath = "github.com/grpc-ecosystem/grpc-gateway/utilities",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
size = "small",
|
||||||
|
srcs = ["trie_test.go"],
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
)
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue